<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>API | Luckysheet文档</title>
    <meta name="generator" content="VuePress 1.8.0">
    
    <meta name="description" content="Luckysheet ，一款纯前端类似excel的在线表格，功能强大、配置简单、完全开源。本站包含官方配置文档,API,教程。">
    <meta property="article:modified_time" content="2021-01-19T01:33:53.000Z">
    <meta property="og:title" content="API">
    <meta property="og:type" content="website">
    <meta property="og:url" content="https://mengshukeji.github.io/LuckysheetDemo/zh/guide/api.html">
    <meta name="twitter:title" content="API">
    <meta name="twitter:url" content="https://mengshukeji.github.io/LuckysheetDemo/zh/guide/api.html">
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:label1" content="Written by">
    
    <link rel="preload" href="/LuckysheetDocs/assets/css/0.styles.58462003.css" as="style"><link rel="preload" href="/LuckysheetDocs/assets/js/app.02d9598d.js" as="script"><link rel="preload" href="/LuckysheetDocs/assets/js/2.daa13025.js" as="script"><link rel="preload" href="/LuckysheetDocs/assets/js/27.1142ecb7.js" as="script"><link rel="prefetch" href="/LuckysheetDocs/assets/js/10.866635ea.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/11.825eabba.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/12.980dcb91.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/13.119fa3a0.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/14.61ea2478.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/15.51a43d85.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/16.de626d16.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/17.e9ae302c.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/18.46d5e5a0.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/19.6ab6bd88.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/20.a4dd0048.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/21.cf5034d8.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/22.c45a4387.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/23.e08fd533.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/24.d1e4369b.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/25.291afc50.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/26.e74f90a6.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/28.d6d28da0.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/29.1ae5f953.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/3.c428902d.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/30.bf70d4f4.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/31.d87cf3af.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/32.a1b6f5f4.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/33.eded6080.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/4.b5e0f872.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/5.e526f9d4.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/6.8106d72b.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/7.c0fe87fd.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/8.abc5c19b.js"><link rel="prefetch" href="/LuckysheetDocs/assets/js/9.2bf3882a.js">
    <link rel="stylesheet" href="/LuckysheetDocs/assets/css/0.styles.58462003.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/LuckysheetDocs/zh/" class="home-link router-link-active"><img src="/LuckysheetDocs/img/logo.png" alt="Luckysheet文档" class="logo"> <span class="site-name can-hide">Luckysheet文档</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/LuckysheetDocs/zh/" class="nav-link">
  首页
</a></div><div class="nav-item"><a href="/LuckysheetDocs/zh/guide/" class="nav-link router-link-active">
  指南
</a></div><div class="nav-item"><a href="https://mengshukeji.github.io/LuckysheetDemo/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  演示
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="了解更多" class="dropdown-title"><span class="title">了解更多</span> <span class="arrow down"></span></button> <button type="button" aria-label="了解更多" class="mobile-dropdown-title"><span class="title">了解更多</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/LuckysheetDocs/zh/about/" class="nav-link">
  关于
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="选择语言" class="dropdown-title"><span class="title">选择语言</span> <span class="arrow down"></span></button> <button type="button" aria-label="选择语言" class="mobile-dropdown-title"><span class="title">选择语言</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/LuckysheetDocs/guide/api.html" class="nav-link">
  English
</a></li><li class="dropdown-item"><!----> <a href="/LuckysheetDocs/zh/guide/api.html" aria-current="page" class="nav-link router-link-exact-active router-link-active">
  简体中文
</a></li></ul></div></div> <a href="https://github.com/mengshukeji/Luckysheet" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/LuckysheetDocs/zh/" class="nav-link">
  首页
</a></div><div class="nav-item"><a href="/LuckysheetDocs/zh/guide/" class="nav-link router-link-active">
  指南
</a></div><div class="nav-item"><a href="https://mengshukeji.github.io/LuckysheetDemo/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  演示
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="了解更多" class="dropdown-title"><span class="title">了解更多</span> <span class="arrow down"></span></button> <button type="button" aria-label="了解更多" class="mobile-dropdown-title"><span class="title">了解更多</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/LuckysheetDocs/zh/about/" class="nav-link">
  关于
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="选择语言" class="dropdown-title"><span class="title">选择语言</span> <span class="arrow down"></span></button> <button type="button" aria-label="选择语言" class="mobile-dropdown-title"><span class="title">选择语言</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/LuckysheetDocs/guide/api.html" class="nav-link">
  English
</a></li><li class="dropdown-item"><!----> <a href="/LuckysheetDocs/zh/guide/api.html" aria-current="page" class="nav-link router-link-exact-active router-link-active">
  简体中文
</a></li></ul></div></div> <a href="https://github.com/mengshukeji/Luckysheet" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><a href="/LuckysheetDocs/zh/guide/" aria-current="page" class="sidebar-link">快速上手</a></li><li><a href="/LuckysheetDocs/zh/guide/config.html" class="sidebar-link">整体配置</a></li><li><a href="/LuckysheetDocs/zh/guide/sheet.html" class="sidebar-link">工作表配置</a></li><li><a href="/LuckysheetDocs/zh/guide/cell.html" class="sidebar-link">单元格</a></li><li><a href="/LuckysheetDocs/zh/guide/operate.html" class="sidebar-link">表格操作</a></li><li><a href="/LuckysheetDocs/zh/guide/api.html" aria-current="page" class="active sidebar-link">API</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/LuckysheetDocs/zh/guide/api.html#单元格操作" class="sidebar-link">单元格操作</a></li><li class="sidebar-sub-header"><a href="/LuckysheetDocs/zh/guide/api.html#行和列操作" class="sidebar-link">行和列操作</a></li><li class="sidebar-sub-header"><a href="/LuckysheetDocs/zh/guide/api.html#选区操作" class="sidebar-link">选区操作</a></li><li class="sidebar-sub-header"><a href="/LuckysheetDocs/zh/guide/api.html#工作表操作" class="sidebar-link">工作表操作</a></li><li class="sidebar-sub-header"><a href="/LuckysheetDocs/zh/guide/api.html#工作簿操作" class="sidebar-link">工作簿操作</a></li><li class="sidebar-sub-header"><a href="/LuckysheetDocs/zh/guide/api.html#图表" class="sidebar-link">图表</a></li><li class="sidebar-sub-header"><a href="/LuckysheetDocs/zh/guide/api.html#数据验证" class="sidebar-link">数据验证</a></li><li class="sidebar-sub-header"><a href="/LuckysheetDocs/zh/guide/api.html#图片" class="sidebar-link">图片</a></li><li class="sidebar-sub-header"><a href="/LuckysheetDocs/zh/guide/api.html#工作表保护" class="sidebar-link">工作表保护</a></li><li class="sidebar-sub-header"><a href="/LuckysheetDocs/zh/guide/api.html#工具方法" class="sidebar-link">工具方法</a></li><li class="sidebar-sub-header"><a href="/LuckysheetDocs/zh/guide/api.html#旧版api" class="sidebar-link">旧版API</a></li></ul></li><li><a href="/LuckysheetDocs/zh/guide/resource.html" class="sidebar-link">教程与资源</a></li><li><a href="/LuckysheetDocs/zh/guide/FAQ.html" class="sidebar-link">常见问题</a></li><li><a href="/LuckysheetDocs/zh/guide/contribute.html" class="sidebar-link">贡献指南</a></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="api"><a href="#api" class="header-anchor">#</a> API</h1> <p>Luckysheet针对常用的数据操作需求，开放了主要功能的API，开发者可以根据需要进行任意对接开发。</p> <p>使用注意：</p> <ol><li>script全局引入时，所有API均挂载到window.luckysheet对象下面，可以在浏览器控制台打印看到；npm引入时，API也全部挂载在luckysheet对象下</li> <li><code>success</code>回调函数第一个参数为API方法的返回值</li> <li>需要新的API请到github <a href="https://github.com/mengshukeji/Luckysheet/issues/new/choose" target="_blank" rel="noopener noreferrer">Issues<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>中提交，根据点赞数决定是否开放新API</li> <li>API方法中所需的<code>order</code>参数为工作表对象中的<code>order</code>的值，而不是<code>index</code></li></ol> <h2 id="单元格操作"><a href="#单元格操作" class="header-anchor">#</a> 单元格操作</h2> <h3 id="getcellvalue-row-column-setting"><a href="#getcellvalue-row-column-setting" class="header-anchor">#</a> getCellValue(row, column [,setting])<div id="getCellValue"></div></h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Number} [row]: 单元格所在行数；从0开始的整数，0表示第一行</li> <li>{Number} [column]: 单元格所在列数；从0开始的整数，0表示第一列</li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{String} [type]: 单元格的值类型，可以设置为原始值<code>v</code>或者显示值<code>m</code>；默认值为<code>v</code>,表示获取单元格的实际值</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>获取单元格的值。</p> <p>特殊情况，单元格格式为<code>yyyy-MM-dd</code>，<code>type</code>为<code>'v'</code>时会强制取<code>'m'</code>显示值</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>返回当前工作表第1行第1列单元格的数据的v值</p> <p><code>luckysheet.getCellValue(0, 0)</code></p></li> <li><p>返回指定data数据的第2行第2列单元格的原始值。</p> <p><code>luckysheet.getCellValue(1, 1, {type:&quot;m&quot;})</code></p></li></ul></li></ul> <hr> <h3 id="setcellvalue-row-column-value-setting"><a href="#setcellvalue-row-column-value-setting" class="header-anchor">#</a> setCellValue(row, column, value [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Number} [row]: 单元格所在行数；从0开始的整数，0表示第一行</li> <li>{Number} [column]: 单元格所在列数；从0开始的整数，0表示第一列</li> <li>{Object | String | Number} [value]: 要设置的值；可以为字符串或数字，或为符合Luckysheet单元格格式的对象，参考 <a href="/LuckysheetDocs/zh/guide/cell.html">单元格属性表</a></li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Boolean} [isRefresh]: 是否刷新界面；默认为<code>true</code>；用于多个单元格赋值时候控制节流，前面单元格赋值的时候应设置为	<code>false</code>，最后一个单元格赋值时设置为<code>true</code>。</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>设置某个单元格的值，也可以设置整个单元格对象，用于同时设置多个单元格属性。</p> <p>如果需要更新公式，也可以在这里赋值，Luckysheet在内部会主动把这个公式做计算并加入到公式链中，最后重刷界面。</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>设置当前工作表&quot;A1&quot;单元格的值为&quot;1&quot;
    	<code>luckysheet.setCellValue(0, 0, 1);</code></p></li> <li><p>设置当前工作表&quot;B1&quot;单元格的值为公式&quot;=sum(A1)&quot;
    	<code>luckysheet.setCellValue(0, 1, &quot;=sum(A1)&quot;);</code></p></li> <li><p>设置当前工作表&quot;C1&quot;单元格的值为公式&quot;=sum(A1:B1&quot;，并带有红色背景，单元格对象可以不带<code>v</code>和<code>m</code>值，Luckysheet会根据公式信息自动计算结果，如果带了未更新或者是非公式结果的<code>v</code>和<code>m</code>值，Luckysheet也仍然会根据公式实际关联的数据计算出准备的结果。
    	<code>luckysheet.setCellValue(0, 2, {f: &quot;=sum(A1:B1)&quot;, bg:&quot;#FF0000&quot;})</code></p> <p>再次设置&quot;C1&quot;单元格新的公式仍然可以生效</p> <p><code>luckysheet.setCellValue(0, 2, {f: &quot;=sum(A1)&quot;, bg:&quot;#00FF00&quot;})</code></p></li></ul></li></ul> <hr> <h3 id="clearcell-row-column-setting"><a href="#clearcell-row-column-setting" class="header-anchor">#</a> clearCell(row, column [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Number} [row]: 单元格所在行数；从0开始的整数，0表示第一行</li> <li>{Number} [column]: 单元格所在列数；从0开始的整数，0表示第一列</li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>清除指定工作表指定单元格的内容，返回清除掉的数据，不同于删除单元格的功能，不需要设定单元格移动情况</p></li> <li><p><strong>示例</strong>:</p> <ul><li>清空单元格<code>B2</code>内容
<code>luckysheet.clearCell(1,1)</code></li></ul></li></ul> <hr> <h3 id="deletecell-move-row-column-setting"><a href="#deletecell-move-row-column-setting" class="header-anchor">#</a> deleteCell(move, row, column [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [move]: 删除后，右侧还是下方的单元格移动</p> <p><code>move</code>可能的值有：</p> <ul><li><code>&quot;left&quot;</code>: 右侧单元格左移</li> <li><code>&quot;up&quot;</code>: 下方单元格上移</li></ul></li> <li><p>{Number} [row]: 单元格所在行数；从0开始的整数，0表示第一行</p></li> <li><p>{Number} [column]: 单元格所在列数；从0开始的整数，0表示第一列</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>删除指定工作表指定单元格，返回删除掉的数据，同时，指定是右侧单元格左移还是下方单元格上移</p></li> <li><p><strong>示例</strong>:</p> <ul><li>删除当前单元格并且在删除后，右侧单元格左移
<code>luckysheet.deleteCell('left')</code></li></ul></li></ul> <hr> <h3 id="setcellformat-row-column-attr-value-setting"><a href="#setcellformat-row-column-attr-value-setting" class="header-anchor">#</a> setCellFormat(row, column, attr, value [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Number} [row]: 单元格所在行数；从0开始的整数，0表示第一行</p></li> <li><p>{Number} [column]: 单元格所在列数；从0开始的整数，0表示第一列</p></li> <li><p>{String} [attr]: 属性类型，参考 <a href="/LuckysheetDocs/zh/guide/cell.html">单元格属性表</a>的属性值</p></li> <li><p>{String | Number | Object} [value]: 具体的设置值，一个属性会对应多个值，参考 <a href="/LuckysheetDocs/zh/guide/cell.html">单元格属性表</a>的值示例，如果属性类型<code>attr</code>是单元格格式<code>ct</code>，则设置值<code>value</code>应提供ct对象，如：<code>{fa:&quot;General&quot;, t:&quot;g&quot;}</code>，比如设置A1单元格的格式为百分比格式：</p> <p><code>luckysheet.setCellFormat(0, 0, &quot;ct&quot;, {fa:&quot;0.00%&quot;, t:&quot;n&quot;})</code></p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>设置某个单元格的属性，如果要设置单元格的值或者同时设置多个单元格属性，推荐使用<code>setCellValue</code></p> <p>特殊的设置</p> <p>边框设置时，attr为<code>&quot;bd&quot;</code>，value为一个key/value对象，需要同时设置边框类型:<code>borderType</code>/边框粗细:<code>style</code>/边框颜色:<code>color</code>，比如设置A1单元格的边框为所有/红色/细：</p> <p><code>luckysheet.setCellFormat(0, 0, &quot;bd&quot;, {borderType: &quot;border-right&quot;,style: &quot;1&quot;, color: &quot;#ff0000&quot;})</code></p> <p>完整可选的设置参数如下：</p> <ul><li>边框类型 <code>borderType：&quot;border-left&quot; | &quot;border-right&quot; | &quot;border-top&quot; | &quot;border-bottom&quot; | &quot;border-all&quot; | &quot;border-outside&quot; | &quot;border-inside&quot; | &quot;border-horizontal&quot; | &quot;border-vertical&quot; | &quot;border-none&quot;</code>，</li> <li>边框粗细 <code>style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick</code></li> <li>边框颜色 <code>color: 16进制颜色值</code></li></ul></li> <li><p><strong>示例</strong>:</p> <ul><li>设置当前工作表A1单元格文本加粗
<code>luckysheet.setCellFormat(0, 0, &quot;bl&quot;, 1)</code></li> <li>设置第二个工作表的B2单元格背景为红色
<code>luckysheet.setCellFormat(1, 1, &quot;bg&quot;, &quot;#ff0000&quot;, {order:1})</code></li> <li>设置当前工作表&quot;A1&quot;单元格的值为&quot;abc&quot;
<code>luckysheet.setCellFormat(0, 0, 'v', 'abc');</code></li></ul></li></ul> <hr> <h3 id="find-content-setting"><a href="#find-content-setting" class="header-anchor">#</a> find(content [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{String} [content]: 要查找的内容</li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Boolean} [isRegularExpression]: 是否正则表达式匹配；默认为 <code>false</code></li> <li>{Boolean} [isWholeWord]: 是否整词匹配；默认为 <code>false</code></li> <li>{Boolean} [isCaseSensitive]: 是否区分大小写匹配；默认为 <code>false</code></li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{String} [type]: 单元格属性；默认值为<code>&quot;m&quot;</code></li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>查找一个工作表中的指定内容，返回查找到的内容组成的单元格一位数组，数据格式同<code>celldata</code>。</p></li> <li><p><strong>示例</strong>:</p> <ul><li>当前工作表查找<code>&quot;value&quot;</code>字符串
<code>luckysheet.find(&quot;value&quot;)</code></li> <li>当前工作表查找公式包含<code>&quot;SUM&quot;</code>的单元格
<code>luckysheet.find(&quot;SUM&quot;,{type:&quot;f&quot;})</code></li></ul></li></ul> <hr> <h3 id="replace-content-replacecontent-setting"><a href="#replace-content-replacecontent-setting" class="header-anchor">#</a> replace(content, replaceContent [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{String} [content]: 要查找的内容</li> <li>{String} [replaceContent]: 要替换的内容</li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Boolean} [isRegularExpression]: 是否正则表达式匹配；默认为 <code>false</code></li> <li>{Boolean} [isWholeWord]: 是否整词匹配；默认为 <code>false</code></li> <li>{Boolean} [isCaseSensitive]: 是否区分大小写匹配；默认为 <code>false</code></li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>查找一个工作表中的指定内容并替换成新的内容，返回替换后的内容组成的单元格一位数组，数据格式同<code>celldata</code>。</p></li> <li><p><strong>示例</strong>:</p> <ul><li>当前工作表查找<code>&quot;value&quot;</code>字符串并替换为<code>&quot;out&quot;</code> <code>luckysheet.replace(&quot;value&quot;, &quot;out&quot;)</code></li></ul></li></ul> <hr> <h3 id="exiteditmode-setting"><a href="#exiteditmode-setting" class="header-anchor">#</a> exitEditMode([,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>退出编辑模式。鼠标双击单元格后，会进入单元格编辑模式，编辑完成后，当鼠标再次点击别的地方输入框失焦的时候，则会退出编辑模式，随即单元格的值会进行保存。此Api就是自动退出编辑模式的操作，主要是为了触发自动保存单元格。</p></li> <li><p><strong>示例</strong>:</p> <ul><li>手动触发退出编辑模式
<code>luckysheet.exitEditMode()</code></li></ul></li></ul> <hr> <h2 id="行和列操作"><a href="#行和列操作" class="header-anchor">#</a> 行和列操作</h2> <h3 id="sethorizontalfrozen-isrange-setting"><a href="#sethorizontalfrozen-isrange-setting" class="header-anchor">#</a> setHorizontalFrozen(isRange [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Boolean} [isRange]: 是否冻结行到选区
<code>isRange</code>可能的值有：</p> <ul><li><code>&quot;false&quot;</code>: 冻结首行</li> <li><code>&quot;true&quot;</code>: 冻结行到选区</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Array | Object | String} [range]: <code>isRange</code>为<code>true</code>的时候设置，开启冻结的单元格位置，格式为<code>{ row_focus:0, column_focus:0 }</code>，意为当前激活的单元格的行数和列数；默认从当前选区最后的一个选区中取得</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>冻结行操作</p> <p>特别注意，只有在<code>isRange</code>设置为<code>true</code>的时候，才需要设置<code>setting</code>中的<code>range</code>，且与一般的range格式不同。</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>冻结首行</p> <p><code>luckysheet.setHorizontalFrozen(false)</code></p></li> <li><p>冻结到<code>B5</code>选区</p> <p><code>luckysheet.setHorizontalFrozen(true, { range: 'B5' })</code></p></li></ul></li></ul> <hr> <h3 id="setverticalfrozen-isrange-setting"><a href="#setverticalfrozen-isrange-setting" class="header-anchor">#</a> setVerticalFrozen(isRange [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Boolean} [isRange]: 是否冻结列到选区
<code>isRange</code>可能的值有：</p> <ul><li><code>&quot;false&quot;</code>: 冻结首列</li> <li><code>&quot;true&quot;</code>: 冻结列到选区</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Array | Object | String} [range]: <code>isRange</code>为<code>true</code>的时候设置，开启冻结的单元格位置，格式为<code>{ row_focus:0, column_focus:0 }</code>，意为当前激活的单元格的行数和列数；默认从当前选区最后的一个选区中取得</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>冻结列操作</p> <p>特别注意，只有在<code>isRange</code>设置为<code>true</code>的时候，才需要设置<code>setting</code>中的<code>range</code>，且与一般的range格式不同。</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>冻结首列</p> <p><code>luckysheet.setVerticalFrozen(false)</code></p></li></ul></li></ul> <hr> <h3 id="setbothfrozen-isrange-setting"><a href="#setbothfrozen-isrange-setting" class="header-anchor">#</a> setBothFrozen(isRange [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Boolean} [isRange]: 是否冻结行列到选区
<code>isRange</code>可能的值有：</p> <ul><li><code>&quot;false&quot;</code>: 冻结行列</li> <li><code>&quot;true&quot;</code>: 冻结行列到选区</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Array | Object | String} [range]: <code>isRange</code>为<code>true</code>的时候设置，开启冻结的单元格位置，格式为<code>{ row_focus:0, column_focus:0 }</code>，意为当前激活的单元格的行数和列数；默认从当前选区最后的一个选区中取得</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>冻结行列操作</p> <p>特别注意，只有在<code>isRange</code>设置为<code>true</code>的时候，才需要设置<code>setting</code>中的<code>range</code>，且与一般的range格式不同。</p> <p>如果想在工作簿初始化后使用此API设置冻结，可以在工作簿创建后的钩子函数中执行，比如：</p> <div class="language-js extra-class"><pre class="language-js"><code>luckysheet<span class="token punctuation">.</span><span class="token function">create</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
	hook<span class="token operator">:</span><span class="token punctuation">{</span>
			<span class="token function-variable function">workbookCreateAfter</span><span class="token operator">:</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
				luckysheet<span class="token punctuation">.</span><span class="token function">setBothFrozen</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
			<span class="token punctuation">}</span>
		<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

</code></pre></div></li> <li><p><strong>示例</strong>:</p> <ul><li><p>冻结行列</p> <p><code>luckysheet.setBothFrozen(false)</code></p></li></ul></li></ul> <hr> <h3 id="cancelfrozen-setting"><a href="#cancelfrozen-setting" class="header-anchor">#</a> cancelFrozen([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>取消冻结操作</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>取消冻结</p> <p><code>luckysheet.cancelFrozen()</code></p></li></ul></li></ul> <hr> <h3 id="insertrow-row-setting"><a href="#insertrow-row-setting" class="header-anchor">#</a> insertRow(row [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Number} [row]: 在第几行插入空白行，从0开始</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [number]: 插入的空白行数；默认为 1</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>在第<code>row</code>行的位置，插入<code>number</code>行空白行</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>在第2行的位置插入1行空白行</p> <p><code>luckysheet.insertRow(1)</code></p></li></ul></li></ul> <hr> <h3 id="insertcolumn-column-setting"><a href="#insertcolumn-column-setting" class="header-anchor">#</a> insertColumn( column [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Number} [column]: 在第几列插入空白列</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [number]: 插入的空白列数；默认为 1</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>在第<code>column</code>列的位置，插入<code>number</code>列空白列</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>在第1列的位置插入3行空白行</p> <p><code>luckysheet.insertColumn(0, { number: 3 })</code></p></li></ul></li></ul> <hr> <h3 id="deleterow-rowstart-rowend-setting"><a href="#deleterow-rowstart-rowend-setting" class="header-anchor">#</a> deleteRow(rowStart, rowEnd [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Number} [rowStart]: 要删除的起始行</p></li> <li><p>{Number} [rowEnd]: 要删除的结束行</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>删除指定的行</p> <p>特别提醒，删除行之后，行的序号并不会变化，下面的行会补充到上面，注意观察数据是否被正确删除即可。</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>删除2-4行</p> <p><code>luckysheet.deleteRow(1, 3)</code></p></li></ul></li></ul> <hr> <h3 id="deletecolumn-columnstart-columnend-setting"><a href="#deletecolumn-columnstart-columnend-setting" class="header-anchor">#</a> deleteColumn(columnStart, columnEnd [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Number} [columnStart]: 要删除的起始列</p></li> <li><p>{Number} [columnEnd]: 要删除的结束列</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>删除指定的列</p> <p>特别提醒，删除列之后，列的序号并不会变化，右边的列会补充到左边，注意观察数据是否被正确删除即可。</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>删除2-4列</p> <p><code>luckysheet.deleteColumn(1, 3)</code></p></li></ul></li></ul> <hr> <h3 id="hiderow-rowstart-rowend-setting"><a href="#hiderow-rowstart-rowend-setting" class="header-anchor">#</a> hideRow(rowStart, rowEnd [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Number} [rowStart]: 要隐藏的起始行</p></li> <li><p>{Number} [rowEnd]: 要隐藏的结束行</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>隐藏指定的行</p> <p>特别提醒，隐藏行之后，行的序号会变化。</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>隐藏2-4行</p> <p><code>luckysheet.hideRow(1, 3)</code></p></li></ul></li></ul> <hr> <h3 id="hidecolumn-columnstart-columnend-setting-todo"><a href="#hidecolumn-columnstart-columnend-setting-todo" class="header-anchor">#</a> hideColumn(columnStart, columnEnd [,setting])(TODO)</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Number} [columnStart]: 要隐藏的起始列</p></li> <li><p>{Number} [columnEnd]: 要隐藏的结束列</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>隐藏指定的列</p> <p>特别提醒，隐藏列之后，列的序号会变化。</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>隐藏2-4列</p> <p><code>luckysheet.hideColumn(1, 3)</code></p></li></ul></li></ul> <hr> <h3 id="showrow-rowstart-rowend-setting"><a href="#showrow-rowstart-rowend-setting" class="header-anchor">#</a> showRow(rowStart, rowEnd [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Number} [rowStart]: 要显示的起始行</p></li> <li><p>{Number} [rowEnd]: 要显示的结束行</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>显示指定的行</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>显示2-4行</p> <p><code>luckysheet.showRow(1, 3)</code></p></li></ul></li></ul> <hr> <h3 id="showcolumn-columnstart-columnend-setting-todo"><a href="#showcolumn-columnstart-columnend-setting-todo" class="header-anchor">#</a> showColumn(columnStart, columnEnd [,setting])(TODO)</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Number} [columnStart]: 要显示的起始列</p></li> <li><p>{Number} [columnEnd]: 要显示的结束列</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>显示指定的列</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>显示2-4列</p> <p><code>luckysheet.showColumn(1, 3)</code></p></li></ul></li></ul> <hr> <h3 id="setrowheight-rowinfo-setting"><a href="#setrowheight-rowinfo-setting" class="header-anchor">#</a> setRowHeight(rowInfo [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Object} [rowInfo]: 行数和高度对应关系</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>设置指定行的高度</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>设置第一行高度为50px，第二行高度为60px</p> <p><code>luckysheet.setRowHeight({0：50，1：60})</code></p></li></ul></li></ul> <hr> <h3 id="setcolumnwidth-columninfo-setting"><a href="#setcolumnwidth-columninfo-setting" class="header-anchor">#</a> setColumnWidth(columnInfo [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Object} [columnInfo]: 列数和宽度对应关系</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>设置指定列的宽度</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>设置第一列宽度为50px，第二列宽度为60px</p> <p><code>luckysheet.setColumnWidth({0：50，1：60})</code></p></li></ul></li></ul> <hr> <h3 id="getrowheight-rowinfo-setting"><a href="#getrowheight-rowinfo-setting" class="header-anchor">#</a> getRowHeight(rowInfo [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Array} [rowInfo]: 行号下标组成的数组；行号下标从0开始；</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>获取指定工作表指定行的高度，得到行号和高度对应关系的对象（第一行行号为0）</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>第一行高度为50px，第二行高度为60px，获取这些值</p> <p><code>luckysheet.getRowHeight([0,1])</code>
返回得到
<code>{0：50，1：60}</code></p></li></ul></li></ul> <hr> <h3 id="getcolumnwidth-columninfo-setting"><a href="#getcolumnwidth-columninfo-setting" class="header-anchor">#</a> getColumnWidth(columnInfo [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Array} [columnInfo]: 列号下标组成的数组；列号下标从0开始；</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>获取指定工作表指定列的宽度，得到列号和宽度对应关系的对象（第一列列号为0）</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>第一列宽度为50px，第二列宽度为60px，获取这些值</p> <p><code>luckysheet.getColumnWidth([0,1])</code>
返回得到
<code>{0：50，1：60}</code></p></li></ul></li></ul> <hr> <h3 id="getdefaultrowheight-setting"><a href="#getdefaultrowheight-setting" class="header-anchor">#</a> getDefaultRowHeight([,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>获取工作表的默认行高</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>返回工作表的默认行高</p> <p><code>luckysheet.getDefaultRowHeight()</code>
返回得到
<code>19</code></p></li></ul></li></ul> <hr> <h3 id="getdefaultcolwidth-setting"><a href="#getdefaultcolwidth-setting" class="header-anchor">#</a> getDefaultColWidth([,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>获取工作表的默认列宽</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>返回工作表的默认列宽</p> <p><code>luckysheet.getDefaultColWidth()</code>
返回得到
<code>73</code></p></li></ul></li></ul> <hr> <h2 id="选区操作"><a href="#选区操作" class="header-anchor">#</a> 选区操作</h2> <h3 id="getrange"><a href="#getrange" class="header-anchor">#</a> getRange()</h3> <ul><li><p><strong>说明</strong>：</p> <p>返回当前选区对象的数组，可能存在多个选区。每个选区的格式为row/column信息组成的对象<code>{row:[0,1],column:[0,1]}</code></p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>当前选区为&quot;A1:B2&quot;和&quot;B4:C5&quot;，执行</p> <p><code>luckysheet.getRange()</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">{</span> <span class="token property">&quot;row&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token property">&quot;column&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span> <span class="token property">&quot;row&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token property">&quot;column&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">]</span> <span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre></div></li></ul></li></ul> <hr> <h3 id="getrangewithflatten"><a href="#getrangewithflatten" class="header-anchor">#</a> getRangeWithFlatten()</h3> <ul><li><p><strong>说明</strong>：</p> <p>返回表示指定区域内所有单元格位置的数组，区别getRange方法，该方法以cell单元格(而非某块连续的区域)为单位来组织选区的数据。</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>在表格中选择指定的区域，然后执行</p> <p><code>luckysheet.getRange()</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">{</span><span class="token property">&quot;row&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token property">&quot;column&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span><span class="token property">&quot;row&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token property">&quot;column&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span><span class="token property">&quot;row&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token property">&quot;column&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre></div><p>其中，{&quot;row&quot;:[0,0],&quot;column&quot;:[0,2]} 表示的是一整块连续的区域。</p></li> <li><p>在表格中选择上面的区域，然后执行</p> <p><code>luckysheet.getRangeWithFlatten()</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">{</span><span class="token property">&quot;r&quot;</span><span class="token operator">:</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token property">&quot;c&quot;</span><span class="token operator">:</span><span class="token number">0</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span><span class="token property">&quot;r&quot;</span><span class="token operator">:</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token property">&quot;c&quot;</span><span class="token operator">:</span><span class="token number">1</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span><span class="token property">&quot;r&quot;</span><span class="token operator">:</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token property">&quot;c&quot;</span><span class="token operator">:</span><span class="token number">2</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span><span class="token property">&quot;r&quot;</span><span class="token operator">:</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token property">&quot;c&quot;</span><span class="token operator">:</span><span class="token number">0</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span><span class="token property">&quot;r&quot;</span><span class="token operator">:</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token property">&quot;c&quot;</span><span class="token operator">:</span><span class="token number">0</span><span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre></div></li></ul></li></ul> <hr> <h3 id="getrangevalueswithflatte"><a href="#getrangevalueswithflatte" class="header-anchor">#</a> getRangeValuesWithFlatte()</h3> <ul><li><p><strong>说明</strong>：</p> <p>返回表示指定区域内所有单元格内容的对象数组</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>在表格中选择指定的区域，然后执行</p> <p><code>luckysheet.getRange()</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">{</span><span class="token property">&quot;row&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token property">&quot;column&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">]</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span><span class="token property">&quot;row&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token property">&quot;column&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span><span class="token property">&quot;row&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token property">&quot;column&quot;</span><span class="token operator">:</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre></div><p>其中，{&quot;row&quot;:[0,0],&quot;column&quot;:[0,2]} 表示的是一整块连续的区域。</p></li> <li><p>在表格中选择上面的区域，然后执行</p> <p><code>luckysheet.getRangeValuesWithFlatte()</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">{</span>
		<span class="token property">&quot;bg&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span><span class="token punctuation">,</span>
		<span class="token property">&quot;bl&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;it&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ff&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;fs&quot;</span><span class="token operator">:</span> <span class="token number">11</span><span class="token punctuation">,</span>
		<span class="token property">&quot;fc&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgb(51, 51, 51)&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ht&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
		<span class="token property">&quot;vt&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
		<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
			<span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;n&quot;</span>
		<span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;1&quot;</span>
	<span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span>
		<span class="token property">&quot;bg&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span><span class="token punctuation">,</span>
		<span class="token property">&quot;bl&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;it&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ff&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;fs&quot;</span><span class="token operator">:</span> <span class="token number">11</span><span class="token punctuation">,</span>
		<span class="token property">&quot;fc&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgb(51, 51, 51)&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ht&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
		<span class="token property">&quot;vt&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
		<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
			<span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;n&quot;</span>
		<span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;2&quot;</span>
	<span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span>
		<span class="token property">&quot;bg&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span><span class="token punctuation">,</span>
		<span class="token property">&quot;bl&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;it&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ff&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;fs&quot;</span><span class="token operator">:</span> <span class="token number">11</span><span class="token punctuation">,</span>
		<span class="token property">&quot;fc&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgb(51, 51, 51)&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ht&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
		<span class="token property">&quot;vt&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
		<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token number">3</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
			<span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;n&quot;</span>
		<span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;3&quot;</span>
	<span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span>
		<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;Background&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
			<span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span>
		<span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;Background&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;bg&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span><span class="token punctuation">,</span>
		<span class="token property">&quot;bl&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
		<span class="token property">&quot;it&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ff&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;fs&quot;</span><span class="token operator">:</span> <span class="token number">11</span><span class="token punctuation">,</span>
		<span class="token property">&quot;fc&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgb(51, 51, 51)&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ht&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
		<span class="token property">&quot;vt&quot;</span><span class="token operator">:</span> <span class="token number">1</span>
	<span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span>
		<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;Border&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
			<span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span>
		<span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;Border&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;bg&quot;</span><span class="token operator">:</span> <span class="token null keyword">null</span><span class="token punctuation">,</span>
		<span class="token property">&quot;bl&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
		<span class="token property">&quot;it&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ff&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
		<span class="token property">&quot;fs&quot;</span><span class="token operator">:</span> <span class="token number">11</span><span class="token punctuation">,</span>
		<span class="token property">&quot;fc&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgb(51, 51, 51)&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ht&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
		<span class="token property">&quot;vt&quot;</span><span class="token operator">:</span> <span class="token number">1</span>
	<span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre></div></li></ul></li></ul> <hr> <h3 id="getrangeaxis"><a href="#getrangeaxis" class="header-anchor">#</a> getRangeAxis()</h3> <ul><li><p><strong>说明</strong>：</p> <p>返回对应当前选区的坐标字符串数组，可能存在多个选区。每个选区可能是单个单元格(如 A1)或多个单元格组成的矩形区域(如 D9:E12)</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>当前选区为&quot;E10:E14&quot;、&quot;A7:B13&quot;、&quot;C4&quot;、 &quot;A3&quot;和&quot;C6:D9&quot;，执行</p> <p><code>luckysheet.getRangeAxis()</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span><span class="token string">&quot;E10:E14&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;A7:B13&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;C4&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;A3&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;C6:D9&quot;</span><span class="token punctuation">]</span>
</code></pre></div></li></ul></li></ul> <hr> <h3 id="getrangevalue-setting"><a href="#getrangevalue-setting" class="header-anchor">#</a> getRangeValue([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>返回指定工作表指定范围的单元格二维数组数据，每个单元格为一个对象。</p> <p><a href="/LuckysheetDocs/zh/guide/cell.html">单元格对象格式参考</a></p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>当前选区为&quot;A1:B2&quot;，执行</p> <p><code>luckysheet.getRangeValue()</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">[</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;vaule1&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;vaule1&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;bg&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgba(255,255,255)&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;bl&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
			<span class="token property">&quot;it&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ff&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
			<span class="token property">&quot;fs&quot;</span><span class="token operator">:</span> <span class="token number">11</span><span class="token punctuation">,</span>
			<span class="token property">&quot;fc&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgb(51, 51, 51)&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ht&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
			<span class="token property">&quot;vt&quot;</span><span class="token operator">:</span> <span class="token number">0</span>
		<span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value3&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value3&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;bg&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgba(255,255,255)&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;bl&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
			<span class="token property">&quot;it&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ff&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
			<span class="token property">&quot;fs&quot;</span><span class="token operator">:</span> <span class="token number">11</span><span class="token punctuation">,</span>
			<span class="token property">&quot;fc&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgb(51, 51, 51)&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ht&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
			<span class="token property">&quot;vt&quot;</span><span class="token operator">:</span> <span class="token number">0</span>
		<span class="token punctuation">}</span>
	<span class="token punctuation">]</span><span class="token punctuation">,</span>
	<span class="token punctuation">[</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;vaule2&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;vaule2&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;bg&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgba(255,255,255)&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;bl&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
			<span class="token property">&quot;it&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ff&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
			<span class="token property">&quot;fs&quot;</span><span class="token operator">:</span> <span class="token number">11</span><span class="token punctuation">,</span>
			<span class="token property">&quot;fc&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgb(51, 51, 51)&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ht&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
			<span class="token property">&quot;vt&quot;</span><span class="token operator">:</span> <span class="token number">0</span>
		<span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value4&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value4&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;bg&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgba(255,255,255)&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;bl&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
			<span class="token property">&quot;it&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ff&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
			<span class="token property">&quot;fs&quot;</span><span class="token operator">:</span> <span class="token number">11</span><span class="token punctuation">,</span>
			<span class="token property">&quot;fc&quot;</span><span class="token operator">:</span> <span class="token string">&quot;rgb(51, 51, 51)&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ht&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
			<span class="token property">&quot;vt&quot;</span><span class="token operator">:</span> <span class="token number">0</span>
		<span class="token punctuation">}</span>
	<span class="token punctuation">]</span>
<span class="token punctuation">]</span>
</code></pre></div></li></ul></li></ul> <hr> <h3 id="getrangehtml-setting"><a href="#getrangehtml-setting" class="header-anchor">#</a> getRangeHtml([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Array | Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，允许多个选区组成的数组；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>复制指定工作表指定单元格区域的数据，返回包含<code>&lt;table&gt;</code>html格式的数据，可用于粘贴到excel中保持单元格样式。</p> <p>特别注意，如果复制多个选区，这几个选区必须有相同的行或者相同的列才能复制，复制出的结果也会自动合并成衔接的数组，比如，多选<code>&quot;C18:C20&quot;</code> / <code>&quot;E18:E20&quot;</code> / <code>&quot;G18:H20&quot;</code>是允许的，但是多选<code>&quot;C18:C20&quot;</code> / <code>&quot;E18:E21&quot;</code>是不允许的</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>当前选区为&quot;A1:B2&quot;，执行</p> <p><code>luckysheet.getRangeHtml()</code></p> <p>则返回结果为：</p> <div class="language-html extra-class"><pre class="language-html"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>table</span> <span class="token attr-name">data-type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>luckysheet_copy_action_table<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>colgroup</span> <span class="token attr-name">width</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>72px<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>colgroup</span><span class="token punctuation">&gt;</span></span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>colgroup</span> <span class="token attr-name">width</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>72px<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>colgroup</span><span class="token punctuation">&gt;</span></span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>tr</span><span class="token punctuation">&gt;</span></span>
		<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>td</span> <span class="token style-attr"><span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span><span class="token style language-css"><span class="token property">height</span><span class="token punctuation">:</span>19px<span class="token punctuation">;</span></span><span class="token punctuation">&quot;</span></span></span><span class="token punctuation">&gt;</span></span>
			value1
		<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>td</span><span class="token punctuation">&gt;</span></span>
		<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>td</span> <span class="token style-attr"><span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span><span class="token punctuation">&quot;</span></span></span><span class="token punctuation">&gt;</span></span>
			value3
		<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>td</span><span class="token punctuation">&gt;</span></span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>tr</span><span class="token punctuation">&gt;</span></span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>tr</span><span class="token punctuation">&gt;</span></span>
		<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>td</span> <span class="token style-attr"><span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span><span class="token style language-css"><span class="token property">height</span><span class="token punctuation">:</span>19px<span class="token punctuation">;</span></span><span class="token punctuation">&quot;</span></span></span><span class="token punctuation">&gt;</span></span>
			value2
		<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>td</span><span class="token punctuation">&gt;</span></span>
		<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>td</span> <span class="token style-attr"><span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span><span class="token punctuation">&quot;</span></span></span><span class="token punctuation">&gt;</span></span>
			value4
		<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>td</span><span class="token punctuation">&gt;</span></span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>tr</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>table</span><span class="token punctuation">&gt;</span></span>
</code></pre></div></li></ul></li></ul> <hr> <h3 id="getrangejson-title-setting"><a href="#getrangejson-title-setting" class="header-anchor">#</a> getRangeJson(title [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Boolean} [title]: 是否首行为标题</p> <p><code>title</code>可能的值有：</p> <ul><li><code>&quot;true&quot;</code>: 首行为标题</li> <li><code>&quot;false&quot;</code>: 首行不为标题</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Array | Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>复制指定工作表指定单元格区域的数据，返回<code>json</code>格式的数据</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>当前选区为&quot;A1:B2&quot;，首行为标题取得json</p> <p><code>luckysheet.getRangeJson(true)</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">{</span> <span class="token property">&quot;value1&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value2&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;value3&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value4&quot;</span> <span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre></div></li> <li><p>当前选区为&quot;A1:B2&quot;，首行不为标题取得json</p> <p><code>luckysheet.getRangeJson(false)</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">{</span> <span class="token property">&quot;A&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value1&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;B&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value3&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span> <span class="token property">&quot;A&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value2&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;B&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value4&quot;</span> <span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre></div></li></ul></li></ul> <hr> <h3 id="getrangearray-dimensional-setting"><a href="#getrangearray-dimensional-setting" class="header-anchor">#</a> getRangeArray(dimensional [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [dimensional]: 数组维度</p> <p><code>dimensional</code>可能的值有：</p> <ul><li><code>&quot;oneDimensional&quot;</code>: 一维数组</li> <li><code>&quot;twoDimensional&quot;</code>: 二维数组</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>复制指定工作表指定单元格区域的数据，返回一维、二维或者自定义行列数的二维数组的数据。</p> <p>特别注意，只有在<code>dimensional</code>设置为<code>custom</code>的时候，才需要设置<code>setting</code>中的<code>row</code>和<code>column</code></p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>当前选区为&quot;A1:B2&quot;，一维数组</p> <p><code>luckysheet.getRangeArray('oneDimensional')</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span><span class="token string">&quot;value1&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;value3&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;value2&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;value4&quot;</span><span class="token punctuation">]</span>
</code></pre></div></li> <li><p>当前选区为&quot;A1:B2&quot;，二维数组</p> <p><code>luckysheet.getRangeArray('twoDimensional')</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">[</span> <span class="token string">&quot;value1&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;value3&quot;</span> <span class="token punctuation">]</span><span class="token punctuation">,</span>
	<span class="token punctuation">[</span> <span class="token string">&quot;value2&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;value4&quot;</span> <span class="token punctuation">]</span>
<span class="token punctuation">]</span>
</code></pre></div></li> <li><p>当前选区为&quot;A1:C5&quot;，由 'value1'到'value15'的值组成，得到3	行2列的二维数组数据</p> <p><code>luckysheet.getRangeArray('custom', { row: 3, column: 2 })</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">[</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value1&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value1&quot;</span>
		<span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value6&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value6&quot;</span>
		<span class="token punctuation">}</span>
	<span class="token punctuation">]</span><span class="token punctuation">,</span>
	<span class="token punctuation">[</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value11&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value11&quot;</span>
		<span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value2&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value2&quot;</span>
		<span class="token punctuation">}</span>
	<span class="token punctuation">]</span><span class="token punctuation">,</span>
	<span class="token punctuation">[</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value7&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value7&quot;</span>
		<span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value12&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value12&quot;</span>
		<span class="token punctuation">}</span>
	<span class="token punctuation">]</span>
<span class="token punctuation">]</span>
</code></pre></div></li></ul></li></ul> <hr> <h3 id="getrangediagonal-type-setting"><a href="#getrangediagonal-type-setting" class="header-anchor">#</a> getRangeDiagonal(type [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [type]: 对角线还是对角线偏移</p> <p><code>type</code>可能的值有：</p> <ul><li><code>&quot;normal&quot;</code>: 对角线</li> <li><code>&quot;anti&quot;</code>: 反对角线</li> <li><code>&quot;offset&quot;</code>: 对角线偏移</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [column]: <code>type</code>为<code>offset</code>的时候设置，对角偏移的列数</li></ul> <ul><li>{Array | Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>复制指定工作表指定单元格区域的数据，返回对角线或者对角线偏移<code>column</code>列后的数据。</p> <p>特别注意，只有在<code>type</code>设置为<code>offset</code>的时候，才需要设置<code>setting</code>中的<code>column</code>。</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>当前选区为&quot;A1:B2&quot;，对角线</p> <p><code>luckysheet.getRangeDiagonal('normal')</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">{</span>
		<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value1&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value1&quot;</span>
	<span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span>
		<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value4&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value4&quot;</span>
	<span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre></div></li> <li><p>当前选区为&quot;A1:B2&quot;，反对角线</p> <p><code>luckysheet.getRangeDiagonal('anti')</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">{</span>
		<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value3&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value3&quot;</span>
	<span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span>
		<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value2&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value2&quot;</span>
	<span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre></div></li> <li><p>当前选区为&quot;A1:B2&quot;，对角线偏移1列</p> <p><code>luckysheet.getRangeDiagonal('offset', { column: 1 })</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">{</span>
		<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value3&quot;</span><span class="token punctuation">,</span>
		<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value3&quot;</span>
	<span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</code></pre></div></li></ul></li></ul> <hr> <h3 id="getrangeboolean-setting"><a href="#getrangeboolean-setting" class="header-anchor">#</a> getRangeBoolean([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Array | Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>复制指定工作表指定单元格区域的数据，返回布尔值的数据</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>当前选区为&quot;A1:B2&quot;</p> <p><code>luckysheet.getRangeBoolean()</code></p> <p>则返回结果为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">[</span> <span class="token boolean">false</span><span class="token punctuation">,</span> <span class="token boolean">false</span> <span class="token punctuation">]</span><span class="token punctuation">,</span>
	<span class="token punctuation">[</span> <span class="token boolean">false</span><span class="token punctuation">,</span> <span class="token boolean">false</span> <span class="token punctuation">]</span>
<span class="token punctuation">]</span>
</code></pre></div></li></ul></li></ul> <hr> <h3 id="setrangeshow-range-setting"><a href="#setrangeshow-range-setting" class="header-anchor">#</a> setRangeShow(range [,setting])<div id="setRangeShow"></div></h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Array | Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，允许多个选区组成的数组；默认为当前选区</li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Boolean} [show]: 是否显示高亮选中效果；默认值为 <code>true</code></li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>指定工作表选中一个或多个选区为选中状态并选择是否高亮，支持多种格式设置。</p> <p>特别提醒，Luckysheet中涉及到的选区范围设置都可以参考这个设置</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>设定当前工作表选区范围<code>A1:B2</code>:</p> <p><code>luckysheet.setRangeShow(&quot;A1:B2&quot;)</code></p></li> <li><p>设定选区范围<code>A1:B2</code>:</p> <p><code>luckysheet.setRangeShow([&quot;A1:B2&quot;])</code></p></li> <li><p>设定选区范围<code>A1:B2</code>:</p> <p><code>luckysheet.setRangeShow({row:[0,1],column:[0,1]})</code></p></li> <li><p>设定选区范围<code>A1:B2</code>:</p> <p><code>luckysheet.setRangeShow([{row:[0,1],column:[0,1]}])</code></p></li> <li><p>设定选区范围<code>A1:B2</code>和<code>C3:D4</code>:</p> <p><code>luckysheet.setRangeShow([&quot;A1:B2&quot;,&quot;C3:D4&quot;])</code></p></li> <li><p>设定选区范围<code>A1:B2</code>和<code>D3</code>:</p> <p><code>luckysheet.setRangeShow([{row:[0,1],column:[0,1]},{row:[2,2],column:[3,3]}])</code></p></li></ul></li></ul> <hr> <h3 id="setrangevalue-data-setting"><a href="#setrangevalue-data-setting" class="header-anchor">#</a> setRangeValue(data [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Array} [data]: 要赋值的单元格二维数组数据，每个单元格的值，可以为字符串或数字，或为符合Luckysheet格式的对象，参考 <a href="/LuckysheetDocs/zh/guide/cell.html">单元格属性表</a></li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Array | Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Boolean} [isRefresh]: 是否刷新界面；默认为<code>true</code>；用于多个单元格赋值时候控制节流，前面单元格赋值的时候应设置为	<code>false</code>，最后一个单元格赋值时设置为<code>true</code>。</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>将一个单元格数组数据赋值到指定的区域，数据格式同<code>getRangeValue</code>方法取到的数据。</p> <p>注意一点，通常<code>getRangeValue</code>方法只是取得选区数据，但是不包含边框和合并单元格信息，当执行<code>setRangeValue</code>的时候，会动态判断上一步是否执行过<code>getRangeValue</code>，如果执行过，会将边框和合并单元格信息一并从Luckysheet配置中取得。</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>赋值到当前选区</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">const</span> data <span class="token operator">=</span> <span class="token punctuation">[</span>
		<span class="token punctuation">[</span>
			<span class="token punctuation">{</span>
				<span class="token string">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value1&quot;</span><span class="token punctuation">,</span>
				<span class="token string">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
					<span class="token string">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span>
					<span class="token string">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span>
				<span class="token punctuation">}</span><span class="token punctuation">,</span>
				<span class="token string">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value1&quot;</span>
			<span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token punctuation">{</span>
				<span class="token string">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value3&quot;</span><span class="token punctuation">,</span>
				<span class="token string">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
					<span class="token string">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span>
					<span class="token string">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span>
				<span class="token punctuation">}</span><span class="token punctuation">,</span>
				<span class="token string">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value3&quot;</span>
			<span class="token punctuation">}</span>
		<span class="token punctuation">]</span><span class="token punctuation">,</span>
		<span class="token punctuation">[</span>
			<span class="token punctuation">{</span>
				<span class="token string">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value2&quot;</span><span class="token punctuation">,</span>
				<span class="token string">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
					<span class="token string">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span>
					<span class="token string">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span>
				<span class="token punctuation">}</span><span class="token punctuation">,</span>
				<span class="token string">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value2&quot;</span>
			<span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token punctuation">{</span>
				<span class="token string">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value4&quot;</span><span class="token punctuation">,</span>
				<span class="token string">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
					<span class="token string">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span>
					<span class="token string">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span>
				<span class="token punctuation">}</span><span class="token punctuation">,</span>
				<span class="token string">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value4&quot;</span>
			<span class="token punctuation">}</span>
		<span class="token punctuation">]</span>
	<span class="token punctuation">]</span>
luckysheet<span class="token punctuation">.</span><span class="token function">setRangeValue</span><span class="token punctuation">(</span>data<span class="token punctuation">,</span><span class="token punctuation">{</span>range<span class="token operator">:</span><span class="token string">&quot;A1:B2&quot;</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div></li></ul></li></ul> <hr> <h3 id="setrangeformat-attr-value-setting"><a href="#setrangeformat-attr-value-setting" class="header-anchor">#</a> setRangeFormat(attr, value [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [attr]: 属性类型，
参考 <a href="/LuckysheetDocs/zh/guide/cell.html">单元格属性表</a>的属性值</p></li> <li><p>{String | Number | Object} [value]: 具体的设置值，一个属性会对应多个值，参考 <a href="/LuckysheetDocs/zh/guide/cell.html">单元格属性表</a>的值示例，特殊情况：如果属性类型<code>attr</code>是单元格格式<code>ct</code>，则设置值<code>value</code>应提供<code>ct.fa</code>，比如设置<code>&quot;A1:B2&quot;</code>单元格的格式为百分比格式：</p> <p><code>luckysheet.setRangeFormat(&quot;ct&quot;, &quot;0.00%&quot;, {range:&quot;A1:B2&quot;})</code></p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Object | String} [range]: 设置参数的目标选区范围，支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，允许多个选区组成的数组；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>设置指定范围的单元格格式，一般用作处理格式，赋值操作推荐使用<code>setRangeValue</code>方法</p> <p>边框设置时，attr为<code>&quot;bd&quot;</code>，value为一个key/value对象，需要同时设置边框类型:<code>borderType</code>/边框粗细:<code>style</code>/边框颜色:<code>color</code>/，比如设置<code>&quot;A1:B2&quot;</code>单元格的边框为所有/红色/细：</p> <p><code>luckysheet.setRangeFormat(&quot;bd&quot;, {borderType: &quot;border-right&quot;,style: &quot;1&quot;, color: &quot;#ff0000&quot;}, {range:[&quot;A1:B2&quot;]})</code></p> <p>完整可选的设置参数如下：</p> <ul><li>边框类型 <code>borderType：&quot;border-left&quot; | &quot;border-right&quot; | &quot;border-top&quot; | &quot;border-bottom&quot; | &quot;border-all&quot; | &quot;border-outside&quot; | &quot;border-inside&quot; | &quot;border-horizontal&quot; | &quot;border-vertical&quot; | &quot;border-none&quot;</code>，</li> <li>边框粗细 <code>style: 1 Thin | 2 Hair | 3 Dotted | 4 Dashed | 5 DashDot | 6 DashDotDot | 7 Double | 8 Medium | 9 MediumDashed | 10 MediumDashDot | 11 MediumDashDotDot | 12 SlantedDashDot | 13 Thick</code></li> <li>边框颜色 <code>color: 16进制颜色值</code></li></ul></li> <li><p><strong>示例</strong>:</p> <ul><li><p>设置当前工作表<code>&quot;A1:B2&quot;</code>范围的单元格文本加粗</p> <p><code>luckysheet.setRangeFormat(&quot;bl&quot;, 1, {range:&quot;A1:B2&quot;})</code></p></li> <li><p>设置第二个工作表的<code>&quot;B2&quot;</code>和<code>&quot;C4:D5&quot;</code>范围的单元格背景为红色</p> <p><code>luckysheet.setRangeFormat(&quot;bg&quot;, &quot;#ff0000&quot;, {range:[&quot;B2&quot;,&quot;C4:D5&quot;], order:1})</code></p></li></ul></li></ul> <hr> <h3 id="setrangefilter-type-setting"><a href="#setrangefilter-type-setting" class="header-anchor">#</a> setRangeFilter(type [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [type]: 打开还是关闭筛选功能</p> <p><code>type</code>可能的值有：</p> <ul><li><code>&quot;open&quot;</code>: 打开筛选功能，返回当前筛选的范围对象</li> <li><code>&quot;close&quot;</code>: 关闭筛选功能，返回关闭前筛选的范围对象</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>为指定下标的工作表，选定的范围开启或关闭筛选功能</p></li> <li><p><strong>示例</strong>:</p> <ul><li>打开第二个工作表&quot;A1:B2&quot;范围的筛选功能
<code>luckysheet.setRangeFilter(&quot;open&quot;,{range:&quot;A1:B2&quot;,order:1})</code></li></ul></li></ul> <hr> <h3 id="setrangemerge-type-setting"><a href="#setrangemerge-type-setting" class="header-anchor">#</a> setRangeMerge(type [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [type]: 合并单元格类型</p> <p><code>type</code>可能的值有：</p> <ul><li><code>&quot;all&quot;</code>: 全部合并，区域内所有单元格合并成一个大的单元格</li> <li><code>&quot;horizontal&quot;</code>: 水平合并，区域内在同一行的单元格合并成一个单元格</li> <li><code>&quot;vertical&quot;</code>: 垂直合并，区域内在同一列的单元格合并成一个单元格</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Array | Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，允许多个选区组成的数组；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>为指定下标的工作表，选定的范围设定合并单元格</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>当前选区 'A1:B2' 设置为合并单元格，类型为全部合并</p> <p><code>luckysheet.setRangeMerge(&quot;all&quot;)</code>
得到 'A1:B1' 的数据为：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">[</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;m&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value1&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;ct&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;fa&quot;</span><span class="token operator">:</span> <span class="token string">&quot;General&quot;</span><span class="token punctuation">,</span> <span class="token property">&quot;t&quot;</span><span class="token operator">:</span> <span class="token string">&quot;g&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
			<span class="token property">&quot;v&quot;</span><span class="token operator">:</span> <span class="token string">&quot;value1&quot;</span><span class="token punctuation">,</span>
			<span class="token property">&quot;mc&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;r&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token property">&quot;c&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token property">&quot;rs&quot;</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token property">&quot;cs&quot;</span><span class="token operator">:</span> <span class="token number">2</span> <span class="token punctuation">}</span>
		<span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;mc&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;r&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token property">&quot;c&quot;</span><span class="token operator">:</span> <span class="token number">0</span> <span class="token punctuation">}</span>
		<span class="token punctuation">}</span>
	<span class="token punctuation">]</span><span class="token punctuation">,</span>
	<span class="token punctuation">[</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;mc&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;r&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token property">&quot;c&quot;</span><span class="token operator">:</span> <span class="token number">0</span> <span class="token punctuation">}</span>
		<span class="token punctuation">}</span><span class="token punctuation">,</span>
		<span class="token punctuation">{</span>
			<span class="token property">&quot;mc&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token property">&quot;r&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token property">&quot;c&quot;</span><span class="token operator">:</span> <span class="token number">0</span> <span class="token punctuation">}</span>
		<span class="token punctuation">}</span>
	<span class="token punctuation">]</span>
<span class="token punctuation">]</span>
</code></pre></div></li></ul></li></ul> <hr> <h3 id="cancelrangemerge-setting"><a href="#cancelrangemerge-setting" class="header-anchor">#</a> cancelRangeMerge( [setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Array | Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，允许多个选区组成的数组；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>为指定下标的工作表，选定的范围取消合并单元格</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>当前选区 'A1:B2' 已为合并单元格，现在要取消合并</p> <p><code>luckysheet.cancelRangeMerge()</code></p></li></ul></li></ul> <hr> <h3 id="setrangesort-type-setting"><a href="#setrangesort-type-setting" class="header-anchor">#</a> setRangeSort(type [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [type]: 排序类型</p> <p><code>type</code>可能的值有：</p> <ul><li><code>&quot;asc&quot;</code>: 升序</li> <li><code>&quot;des&quot;</code>: 降序</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Array | Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>为指定下标的工作表，选定的范围开启排序功能，返回选定范围排序后的数据。</p></li> <li><p><strong>示例</strong>:</p> <ul><li>设置当前工作表当前选区为升序
<code>luckysheet.setRangeSort(&quot;asc&quot;)</code></li></ul></li></ul> <hr> <h3 id="setrangesortmulti-title-sort-setting"><a href="#setrangesortmulti-title-sort-setting" class="header-anchor">#</a> setRangeSortMulti(title, sort [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Boolean} [title]: 数据是否具有标题行</p></li> <li><p>{Array} [sort]: 列设置，设置需要排序的列索引和排序方式，格式如：<code>[{ i:0,sort:'asc' },{ i:1,sort:'des' }]</code></p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Array | Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>为指定下标的工作表，选定的范围开启多列自定义排序功能，返回选定范围排序后的数据。</p></li> <li><p><strong>示例</strong>:</p> <ul><li>设置当前工作表当前选区为自定义排序，数据具有标题行，且按第一列升序第二列降序的规则进行排序
<code>luckysheet.setRangeSortMulti(true,[{ i:0,sort:'asc' },{ i:1,sort:'des' }])</code></li></ul></li></ul> <hr> <h3 id="setrangeconditionalformatdefault-conditionname-conditionvalue-setting"><a href="#setrangeconditionalformatdefault-conditionname-conditionvalue-setting" class="header-anchor">#</a> setRangeConditionalFormatDefault(conditionName, conditionValue [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [conditionName]: 条件格式规则类型</p> <p><code>conditionName</code>可能的值有：</p> <ul><li><code>&quot;greaterThan&quot;</code>: 大于（conditionValue值为 数值或单元格范围）</li> <li><code>&quot;lessThan&quot;</code>: 小于（conditionValue值为 数值或单元格范围）</li> <li><code>&quot;betweenness&quot;</code>: 介于（conditionValue值为 数值或单元格范围）</li> <li><code>&quot;equal&quot;</code>: 等于（conditionValue值为 数值或单元格范围）</li> <li><code>&quot;textContains&quot;</code>: 文本包含（conditionValue值为 文本或单元格范围）</li> <li><code>&quot;occurrenceDate&quot;</code>: 发生日期（conditionValue值为 日期）</li> <li><code>&quot;duplicateValue&quot;</code>: 重复值(conditionValue值为 '0':重复值, '1':唯一值)</li> <li><code>&quot;top10&quot;</code>: 前 N 项（conditionValue值为 1~1000）</li> <li><code>&quot;top10%&quot;</code>: 前 N%（conditionValue值为 1~1000）</li> <li><code>&quot;last10&quot;</code>: 后 N 项（conditionValue值为 1~1000）</li> <li><code>&quot;last10%&quot;</code>: 后 N%（conditionValue值为 1~1000）</li> <li><code>&quot;AboveAverage&quot;</code>: 高于平均值（conditionValue可为空数组）</li> <li><code>&quot;SubAverage&quot;</code>: 低于平均值（conditionValue可为空数组）</li></ul></li> <li><p>{Array} [conditionValue]: 可以设置条件单元格或者条件值
取值规则 （条件值数组最少一个值，最多两个值）</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token punctuation">[</span><span class="token number">2</span><span class="token punctuation">]</span>
</code></pre></div><p>或者 （若值为单元格范围，则取左上角单元格值）</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token punctuation">[</span><span class="token string">'A1'</span><span class="token punctuation">]</span>
</code></pre></div></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li><p>{Object} [format]: 颜色设置</p> <ul><li>设置文本颜色和单元格颜色；默认值为<code>{ &quot;textColor&quot;: &quot;#000000&quot;, &quot;cellColor&quot;: &quot;#ff0000&quot; }</code></li></ul></li> <li><p>{Array | Object | String} [cellrange]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，允许多个选区组成的数组；默认为当前选区</p></li> <li><p>{Number} [order]: 工作表下标；默认值为当前工作表下标</p></li> <li><p>{Function} [success]: 操作结束的回调函数</p></li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>为指定下标的工作表，选定的范围开启条件格式，根据设置的条件格式规则突出显示部分单元格，返回开启条件格式后的数据。</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>突出显示内容大于数字2的单元格
<code>luckysheet.setRangeConditionalFormatDefault(&quot;greaterThan&quot;,{ type: 'value', content: [2] })</code></p></li> <li><p>突出显示内容小于单元格A1内容的单元格
<code>luckysheet.setRangeConditionalFormatDefault(&quot;lessThan&quot;,{ type: 'range', content: ['A1'] })</code></p></li> <li><p>突出显示内容介于2和10之间的单元格
<code>luckysheet.setRangeConditionalFormatDefault(&quot;betweenness&quot;,{ type: 'value', content: [2,10] })</code></p></li> <li><p>突出显示内容等于单元格A1内容的单元格
<code>luckysheet.setRangeConditionalFormatDefault(&quot;equal&quot;,{ type: 'range', content: ['A1'] })</code></p></li> <li><p>突出显示内容包含单元格A1内容的单元格
<code>luckysheet.setRangeConditionalFormatDefault(&quot;textContains&quot;,{ type: 'range', content: ['A1'] })</code></p></li> <li><p>突出显示日期在 <code>2020/09/24 - 2020/10/15</code> 之间的单元格
<code>luckysheet.setRangeConditionalFormatDefault(&quot;occurrenceDate&quot;,{ type: 'value', content: ['2020/09/24 - 2020/10/15'] })</code></p></li> <li><p>突出显示重复值的单元格，content为0
<code>luckysheet.setRangeConditionalFormatDefault(&quot;duplicateValue&quot;,{ type: 'value', content: [0] })</code></p></li> <li><p>突出显示唯一值的单元格，content为1
<code>luckysheet.setRangeConditionalFormatDefault(&quot;duplicateValue&quot;,{ type: 'value', content: [1] })</code></p></li> <li><p>突出显示排名前20名的单元格
<code>luckysheet.setRangeConditionalFormatDefault(&quot;top&quot;,{ type: 'value', content: [20] })</code></p></li> <li><p>突出显示排名前30%的单元格
<code>luckysheet.setRangeConditionalFormatDefault(&quot;topPercent&quot;,{ type: 'value', content: [30] })</code></p></li> <li><p>突出显示排名后15名的单元格
<code>luckysheet.setRangeConditionalFormatDefault(&quot;last&quot;,{ type: 'value', content: [15] })</code></p></li> <li><p>突出显示排名后15%的单元格
<code>luckysheet.setRangeConditionalFormatDefault(&quot;lastPercent&quot;,{ type: 'value', content: [15] })</code></p></li> <li><p>突出显示高于平均值的单元格
<code>luckysheet.setRangeConditionalFormatDefault(&quot;AboveAverage&quot;,{ type: 'value', content: ['AboveAverage'] })</code></p></li> <li><p>突出显示低于平均值的单元格
<code>luckysheet.setRangeConditionalFormatDefault(&quot;SubAverage&quot;,{ type: 'value', content: ['SubAverage'] })</code></p></li></ul></li></ul> <hr> <h3 id="setrangeconditionalformat-type-setting"><a href="#setrangeconditionalformat-type-setting" class="header-anchor">#</a> setRangeConditionalFormat(type [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [type]: 条件格式规则类型</p> <p><code>type</code>可能的值有：</p> <ul><li><code>&quot;dataBar&quot;</code>: 数据条</li> <li><code>&quot;icons&quot;</code>: 图标集</li> <li><code>&quot;colorGradation&quot;</code>: 色阶</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li><p>{Array | String} [format]: 颜色设置</p> <ul><li><p><code>type</code>为<code>dataBar</code>时，应设置渐变色；默认值为蓝-白渐变<code>[&quot;#638ec6&quot;, &quot;#ffffff&quot;]</code></p> <p>推荐的快捷取值：</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token punctuation">[</span><span class="token string">&quot;#638ec6&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;#ffffff&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//蓝-白渐变 数据条</span>
<span class="token punctuation">[</span><span class="token string">&quot;#63c384&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;#ffffff&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//绿-白渐变 数据条</span>
<span class="token punctuation">[</span><span class="token string">&quot;#ff555a&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;#ffffff&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//红-白渐变 数据条</span>
<span class="token punctuation">[</span><span class="token string">&quot;#ffb628&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;#ffffff&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//橙-白渐变 数据条</span>
<span class="token punctuation">[</span><span class="token string">&quot;#008aef&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;#ffffff&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//浅蓝-白渐变 数据条</span>
<span class="token punctuation">[</span><span class="token string">&quot;#d6007b&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;#ffffff&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//紫-白渐变 数据条</span>
<span class="token punctuation">[</span><span class="token string">&quot;#638ec6&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//蓝色 数据条</span>
<span class="token punctuation">[</span><span class="token string">&quot;#63c384&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//绿色 数据条</span>
<span class="token punctuation">[</span><span class="token string">&quot;#ff555a&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//红色 数据条</span>
<span class="token punctuation">[</span><span class="token string">&quot;#ffb628&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//橙色 数据条</span>
<span class="token punctuation">[</span><span class="token string">&quot;#008aef&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//浅蓝色 数据条</span>
<span class="token punctuation">[</span><span class="token string">&quot;#d6007b&quot;</span><span class="token punctuation">]</span>   <span class="token comment">//紫色 数据条</span>
</code></pre></div></li> <li><p><code>type</code>为<code>icons</code>时，应设置图标类型；默认值为&quot;threeWayArrowMultiColor&quot;：三向箭头彩色，</p> <p>可取值为：</p> <p><code>threeWayArrowMultiColor</code>：三向箭头（彩色），</p> <p><code>threeTriangles</code>：3个三角形，</p> <p><code>fourWayArrowMultiColor</code>：四向箭头（彩色），</p> <p><code>fiveWayArrowMultiColor</code>：五向箭头（彩色），</p> <p><code>threeWayArrowGrayColor</code>：三向箭头（灰色），</p> <p><code>fourWayArrowGrayColor</code>：四向箭头（灰色），</p> <p><code>fiveWayArrowGrayColor</code>：五向箭头（灰色），</p> <p><code>threeColorTrafficLightRimless</code>：三色交通灯（无边框），</p> <p><code>threeSigns</code>：三标志，</p> <p><code>greenRedBlackGradient</code>：绿-红-黑渐变，</p> <p><code>threeColorTrafficLightBordered</code>：三色交通灯（有边框），</p> <p><code>fourColorTrafficLight</code>：四色交通灯，</p> <p><code>threeSymbolsCircled</code>：三个符号（有圆圈），</p> <p><code>tricolorFlag</code>：三色旗，</p> <p><code>threeSymbolsnoCircle</code>：三个符号（无圆圈），</p> <p><code>threeStars</code>：3个星形，</p> <p><code>fiveQuadrantDiagram</code>：五象限图，</p> <p><code>fiveBoxes</code>：5个框，</p> <p><code>grade4</code>：四等级，</p> <p><code>grade5</code>：五等级，</p></li> <li><p><code>type</code>为<code>colorGradation</code>时，应设置色阶颜色值；默认值为绿-黄-红色阶<code>[&quot;rgb(99, 190, 123)&quot;, &quot;rgb(255, 235, 132)&quot;, &quot;rgb(248, 105, 107)&quot;]</code></p> <p>推荐的快捷取值：</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token punctuation">[</span><span class="token string">&quot;rgb(99, 190, 123)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(255, 235, 132)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(248, 105, 107)&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//绿-黄-红色阶</span>
<span class="token punctuation">[</span><span class="token string">&quot;rgb(248, 105, 107)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(255, 235, 132)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(99, 190, 123)&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//红-黄-绿色阶</span>

<span class="token punctuation">[</span><span class="token string">&quot;rgb(99, 190, 123)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(252, 252, 255)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(248, 105, 107)&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//绿-白-红色阶</span>
<span class="token punctuation">[</span><span class="token string">&quot;rgb(248, 105, 107)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(252, 252, 255)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(99, 190, 123)&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//红-白-绿色阶</span>

<span class="token punctuation">[</span><span class="token string">&quot;rgb(90, 138, 198)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(252, 252, 255)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(248, 105, 107)&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//蓝-白-红色阶</span>
<span class="token punctuation">[</span><span class="token string">&quot;rgb(248, 105, 107)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(252, 252, 255)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(90, 138, 198)&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//红-白-蓝色阶</span>

<span class="token punctuation">[</span><span class="token string">&quot;rgb(252, 252, 255)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(248, 105, 107)&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//白-红色阶</span>
<span class="token punctuation">[</span><span class="token string">&quot;rgb(248, 105, 107)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(252, 252, 255)&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//红-白色阶</span>

<span class="token punctuation">[</span><span class="token string">&quot;rgb(99, 190, 123)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(252, 252, 255)&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//绿-白色阶</span>
<span class="token punctuation">[</span><span class="token string">&quot;rgb(252, 252, 255)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(99, 190, 123)&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//白-绿色阶</span>

<span class="token punctuation">[</span><span class="token string">&quot;rgb(99, 190, 123)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(255, 235, 132)&quot;</span><span class="token punctuation">]</span><span class="token punctuation">,</span>  <span class="token comment">//绿-黄色阶</span>
<span class="token punctuation">[</span><span class="token string">&quot;rgb(255, 235, 132)&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;rgb(99, 190, 123)&quot;</span><span class="token punctuation">]</span>   <span class="token comment">//黄-绿色阶</span>
</code></pre></div></li></ul></li> <li><p>{Array | Object | String} [cellrange]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，允许多个选区组成的数组；默认为当前选区</p></li> <li><p>{Number} [order]: 工作表下标；默认值为当前工作表下标</p></li> <li><p>{Function} [success]: 操作结束的回调函数</p></li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>为指定下标的工作表，选定的范围开启条件格式，返回开启条件格式后的数据。</p></li> <li><p><strong>示例</strong>:</p> <ul><li>当前选区范围开启条件格式，显示渐变色
<code>luckysheet.setRangeConditionalFormat(&quot;dataBar&quot;, { format: [&quot;#63c384&quot;, &quot;#ffffff&quot;] })</code></li></ul></li></ul> <hr> <h3 id="deleterangeconditionalformat-itemindex-setting"><a href="#deleterangeconditionalformat-itemindex-setting" class="header-anchor">#</a> deleteRangeConditionalFormat(itemIndex [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Number} [itemIndex]: 条件格式规则索引</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>为指定下标的工作表，删除条件格式规则，返回被删除的条件格式规则。</p></li> <li><p><strong>示例</strong>:</p> <ul><li>删除第三个条件格式规则
<code>luckysheet.deleteRangeConditionalFormat(2)</code></li></ul></li></ul> <hr> <h3 id="clearrange-setting"><a href="#clearrange-setting" class="header-anchor">#</a> clearRange([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Array | Object | String} [range]: 要清除的选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，允许多个选区组成的数组；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>清除指定工作表指定单元格区域的内容，不同于删除选区的功能，不需要设定单元格移动情况</p></li> <li><p><strong>示例</strong>:</p> <ul><li>清空当前选区内容
<code>luckysheet.clearRange()</code></li></ul></li></ul> <hr> <h3 id="deleterange-move-setting"><a href="#deleterange-move-setting" class="header-anchor">#</a> deleteRange(move [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [move]: 删除后，右侧还是下方的单元格移动</p> <p><code>move</code>可能的值有：</p> <ul><li><code>&quot;left&quot;</code>: 右侧单元格左移</li> <li><code>&quot;up&quot;</code>: 下方单元格上移</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Object | String} [range]: 要删除的选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>删除指定工作表指定单元格区域，同时，指定是右侧单元格左移还是下方单元格上移</p></li> <li><p><strong>示例</strong>:</p> <ul><li>删除当前选区并且在删除后，右侧单元格左移
<code>luckysheet.deleteRange('left')</code></li></ul></li></ul> <hr> <h3 id="insertrange-move-setting"><a href="#insertrange-move-setting" class="header-anchor">#</a> insertRange(move [,setting])</h3> <p>[todo]</p> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [move]: 活动单元格右移或者下移</p> <p><code>move</code>可能的值有：</p> <ul><li><code>&quot;right&quot;</code>: 活动单元格右移</li> <li><code>&quot;bottom&quot;</code>: 活动单元格下移</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li><p>{Array} [data]: 赋值到range区域的单元格二维数组数据，<a href="/LuckysheetDocs/zh/guide/cell.html">单元格对象格式参考</a>；默认值为空数组，即插入空白的区域</p></li> <li><p>{Array | Object | String} [range]: 要插入的位置，选区范围，支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，默认为当前选区</p> <p>当未设置data数据时，允许多个选区组成的数组，插入的空白区域即为这些选区的区域，</p> <p>当设置了data数据，只能为单个选区，并且会把data数据插入到当前选区的第一个单元格位置</p></li> <li><p>{Number} [order]: 工作表下标；默认值为当前工作表下标</p></li> <li><p>{Function} [success]: 操作结束的回调函数</p></li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>在指定工作表指定单元格区域，赋值单元格数据，或者新建一块空白区域，返回data数据，同时，指定活动单元格右移或者下移</p></li> <li><p><strong>示例</strong>:</p> <ul><li>当前选区位置插入空白单元格，并且插入后当前选区单元格右移
<code>luckysheet.insertRange('right')</code></li></ul></li></ul> <hr> <h3 id="matrixoperation-type-setting"><a href="#matrixoperation-type-setting" class="header-anchor">#</a> matrixOperation(type [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [type]: 矩阵操作的类型</p> <p><code>type</code>可能的值有：</p> <ul><li><code>&quot;flipUpDown&quot;</code>: 上下翻转</li> <li><code>&quot;flipLeftRight&quot;</code>: 左右翻转</li> <li><code>&quot;flipClockwise&quot;</code>: 顺时针旋转</li> <li><code>&quot;flipCounterClockwise&quot;</code>: 逆时针旋转</li> <li><code>&quot;Transpose&quot;</code>: 转置</li> <li><code>&quot;DeleteZeroByRow&quot;</code>: 按行删除两端0值</li> <li><code>&quot;DeleteZeroByColumn&quot;</code>: 按列删除两端0值</li> <li><code>&quot;removeDuplicateByRow&quot;</code>: 按行删除重复值</li> <li><code>&quot;removeDuplicateByColumn&quot;</code>: 按列删除重复值</li> <li><code>&quot;newMatrix&quot;</code>: 生产新矩阵</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Array | Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>指定工作表指定单元格区域的数据进行矩阵操作，返回操作成功后的结果数据</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>当前选区上下翻转</p> <p><code>luckysheet.matrixOperation('flipUpDown')</code></p> <p>原来的选区复制为二维数组：</p> <p><code>[[&quot;value1&quot;,&quot;value3&quot;],[&quot;value2&quot;,&quot;value4&quot;]]</code></p> <p>上下翻转后选区复制为二维数组：</p> <p><code>[[&quot;value2&quot;,&quot;value4&quot;],[&quot;value1&quot;,&quot;value3&quot;]]</code></p></li></ul></li></ul> <hr> <h3 id="matrixcalculation-type-number-setting"><a href="#matrixcalculation-type-number-setting" class="header-anchor">#</a> matrixCalculation(type, number [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [type]: 计算方式</p> <p><code>type</code>可能的值有：</p> <ul><li><code>&quot;plus&quot;</code>: 加</li> <li><code>&quot;minus&quot;</code>: 减</li> <li><code>&quot;multiply&quot;</code>: 乘</li> <li><code>&quot;divided&quot;</code>: 除</li> <li><code>&quot;power&quot;</code>: 次方</li> <li><code>&quot;root&quot;</code>: 次方根</li> <li><code>&quot;log&quot;</code>: log</li></ul></li> <li><p>{Number} [number]: 计算数值，如: 2</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Array | Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>指定工作表指定单元格区域的数据进行矩阵计算，返回计算成功后的结果数据</p></li> <li><p><strong>示例</strong>:</p> <ul><li><p>当前选区所有单元格值加2</p> <p><code>luckysheet.matrixCalculation('plus', 2)</code></p> <p>原来的选区复制为二维数组：</p> <p><code>[[1,2],[3,4]]</code></p> <p>加2后选区复制为二维数组：</p> <p><code>[[3,4],[5,6]]</code></p></li></ul></li></ul> <hr> <h2 id="工作表操作"><a href="#工作表操作" class="header-anchor">#</a> 工作表操作</h2> <h3 id="getallsheets"><a href="#getallsheets" class="header-anchor">#</a> getAllSheets()</h3> <ul><li><p><strong>说明</strong>：</p> <p>返回所有工作表配置，格式同工作表配置，得到的结果可用于表格初始化时作为options.data使用。</p> <p>所以此API适用于，手动操作配置完一个表格后，将所有工作表信息取出来自行保存，再用于其他地方的表格创建。如果想得到包括工作簿配置在内的所有工作簿数据，推荐使用 <a href="#toJson()">toJson</a>，并且可以直接用于初始化Luckysheet。</p></li> <li><p><strong>示例</strong>:</p> <ul><li>取得第一个工作表的所有基本信息
<code>luckysheet.getAllSheets()[0]</code></li></ul></li></ul> <hr> <h3 id="getluckysheetfile"><a href="#getluckysheetfile" class="header-anchor">#</a> getLuckysheetfile()</h3> <ul><li><p><strong>说明</strong>：</p> <p>返回所有表格数据结构的一维数组<code>luckysheetfile</code>，不同于<code>getAllSheets</code>方法，此方法得到的工作表参数会包含很多内部使用变量，最明显的区别是表格数据操作会维护<code>luckysheetfile[i].data</code>，而初始化数据采用的是<code>options.data[i].celldata</code>，所以<code>luckysheetfile</code>可用于调试使用，但是不适用初始化表格。</p> <p>除此之外，加载过的工作表参数中会增加一个<code>load = 1</code>，这个参数在初始化数据的时候需要置为0才行。所以，将<code>getLuckysheetfile()</code>得到的数据拿来初始化工作簿，需要做两个工作：</p> <ul><li>celldata转为data，参考:<a href="/LuckysheetDocs/zh/guide/api.html#transtodata-celldata-setting">transToData</a></li> <li>load重置为0或者删除此字段</li></ul> <p>现在已有<code>getAllSheets</code>来完成这个工作，无需再手动转化数据。</p></li> <li><p><strong>示例</strong>:</p> <ul><li>取得第一个工作表的所有调试信息
<code>luckysheet.getLuckysheetfile()[0]</code></li></ul></li></ul> <hr> <h3 id="getsheet-setting"><a href="#getsheet-setting" class="header-anchor">#</a> getSheet([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [index]: 工作表索引；默认值为当前工作表索引</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Number} [name]: 工作表名称；默认值为当前工作表名称</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>根据index/order/name，快捷返回指定工作表的配置，同 <code>luckysheetfile[i]</code>。如果设置多个参数，优先级为：index &gt; order &gt; name。</p></li></ul> <hr> <h3 id="getsheetdata-setting"><a href="#getsheetdata-setting" class="header-anchor">#</a> getSheetData([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>快捷返回指定工作表的数据，同 <code>luckysheetfile[i].data</code></p></li></ul> <hr> <h3 id="getconfig-setting"><a href="#getconfig-setting" class="header-anchor">#</a> getConfig([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>快捷返回指定工作表的config配置，同 <code>luckysheetfile[i].config</code></p></li></ul> <hr> <h3 id="setconfig-cfg-setting"><a href="#setconfig-cfg-setting" class="header-anchor">#</a> setConfig(cfg, [setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Object} [cfg]: config配置</li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>快捷设置指定工作表config配置</p></li></ul> <hr> <h3 id="setsheetadd-setting"><a href="#setsheetadd-setting" class="header-anchor">#</a> setSheetAdd([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Object} [sheetObject]: 新增的工作表的数据；默认值为空对象，工作表数据格式参考<a href="/LuckysheetDocs/zh/guide/sheet.html#初始化配置">options.data</a></li> <li>{Number} [order]: 新增的工作表下标；默认值为最后一个下标位置</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>新增一个sheet，返回新增的工作表对象，<code>setting</code>中可选设置数据为 <code>sheetObject</code>，不传<code>sheetObject</code>则会新增一个空白的工作表。</p></li> <li><p><strong>示例</strong>:</p> <ul><li>在最后一个工作表下标位置新增一个空白的工作表
<code>luckysheet.setSheetAdd()</code></li></ul></li></ul> <hr> <h3 id="setsheetdelete-setting"><a href="#setsheetdelete-setting" class="header-anchor">#</a> setSheetDelete([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>删除指定下标的工作表，返回已删除的工作表对象</p></li> <li><p><strong>示例</strong>:</p> <ul><li>删除当前工作表
<code>luckysheet.setSheetDelete()</code></li></ul></li></ul> <hr> <h3 id="setsheetcopy-setting"><a href="#setsheetcopy-setting" class="header-anchor">#</a> setSheetCopy([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [targetOrder]: 新复制的工作表目标下标位置；默认值为当前工作表下标的下一个下标位置（递增）</li> <li>{Number} [order]: 被复制的工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>复制指定下标的工作表到指定下标位置，在<code>setting</code>中可选设置指定下标位置<code>targetOrder</code>，返回新复制的工作表对象</p></li> <li><p><strong>示例</strong>:</p> <ul><li>复制当前工作表到下一个下标位置
<code>luckysheet.setSheetCopy()</code></li></ul></li></ul> <hr> <h3 id="setsheethide-setting"><a href="#setsheethide-setting" class="header-anchor">#</a> setSheetHide([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 被隐藏的工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>隐藏指定下标的工作表，返回被隐藏的工作表对象</p></li> <li><p><strong>示例</strong>:</p> <ul><li>隐藏当前工作表
<code>luckysheet.setSheetHide()</code></li> <li>隐藏第三个工作表
<code>luckysheet.setSheetHide({order:2})</code></li></ul></li></ul> <hr> <h3 id="setsheetshow-setting"><a href="#setsheetshow-setting" class="header-anchor">#</a> setSheetShow([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 被取消隐藏的工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>取消隐藏指定下标的工作表，返回被取消隐藏的工作表对象</p></li> <li><p><strong>示例</strong>:</p> <ul><li>取消隐藏第三个工作表
<code>luckysheet.setSheetShow({order:2})</code></li></ul></li></ul> <hr> <h3 id="setsheetactive-order-setting"><a href="#setsheetactive-order-setting" class="header-anchor">#</a> setSheetActive(order [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Number} [order]: 要激活的工作表下标</li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>设置指定下标的工作表为当前工作表（激活态），即切换到指定的工作表，返回被激活的工作表对象</p></li> <li><p><strong>示例</strong>:</p> <ul><li>切换到第二个工作表
<code>luckysheet.setSheetActive(1)</code></li></ul></li></ul> <hr> <h3 id="setsheetname-name-setting"><a href="#setsheetname-name-setting" class="header-anchor">#</a> setSheetName(name [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{String} [name]: 新的工作表名称</li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>修改工作表名称</p></li> <li><p><strong>示例</strong>:</p> <ul><li>修改当前工作表名称为&quot;CellSheet&quot;
<code>luckysheet.setSheetName(&quot;CellSheet&quot;)</code></li></ul></li></ul> <hr> <h3 id="setsheetcolor-color-setting"><a href="#setsheetcolor-color-setting" class="header-anchor">#</a> setSheetColor(color [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{String} [color]: 工作表颜色</li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>设置工作表名称处的颜色</p></li> <li><p><strong>示例</strong>:</p> <ul><li>修改当前工作表名称处的颜色为红色
<code>luckysheet.setSheetColor(&quot;#ff0000&quot;)</code></li></ul></li></ul> <hr> <h3 id="setsheetmove-type-setting"><a href="#setsheetmove-type-setting" class="header-anchor">#</a> setSheetMove(type [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String | Number} [type]: 工作表移动方向或者移动的目标下标，</p> <p><code>type</code>可能的值有：</p> <ul><li><code>&quot;left&quot;</code>: 向左</li> <li><code>&quot;right&quot;</code>: 向右</li> <li><code>1</code>/<code>2</code>/<code>3</code>/...: 指定下标</li></ul></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>指定工作表向左边或右边移动一个位置，或者指定下标，返回指定的工作表对象</p></li> <li><p><strong>示例</strong>:</p> <ul><li>当前工作表向左移动一个位置
<code>luckysheet.setSheetMove(&quot;left&quot;)</code></li> <li>第二个工作表移动到第四个工作表的下标位置
<code>luckysheet.setSheetMove(3,{order:1})</code></li></ul></li></ul> <hr> <h3 id="setsheetorder-orderlist-setting"><a href="#setsheetorder-orderlist-setting" class="header-anchor">#</a> setSheetOrder(orderList [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Array} [orderList]: 工作表顺序，设置工作表的index和order来指定位置，如：</li></ul> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">[</span>
	<span class="token punctuation">{</span>index<span class="token operator">:</span>'sheet_01'<span class="token punctuation">,</span>order<span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span>index<span class="token operator">:</span>'sheet_02'<span class="token punctuation">,</span>order<span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span>index<span class="token operator">:</span>'sheet_03'<span class="token punctuation">,</span>order<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">]</span>
</code></pre></div><p>数组中顺序并不重要，关键是指定sheet index和order的对应关系。</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>重新排序所有工作表的位置，指定工作表顺序的数组。</p></li> <li><p><strong>示例</strong>:</p> <ul><li>重排工作表，此工作簿含有3个工作表</li></ul> <div class="language-js extra-class"><pre class="language-js"><code>luckysheet<span class="token punctuation">.</span><span class="token function">setSheetOrder</span><span class="token punctuation">(</span><span class="token punctuation">[</span>
	<span class="token punctuation">{</span>index<span class="token operator">:</span><span class="token string">'sheet_01'</span><span class="token punctuation">,</span>order<span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span>index<span class="token operator">:</span><span class="token string">'sheet_02'</span><span class="token punctuation">,</span>order<span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
	<span class="token punctuation">{</span>index<span class="token operator">:</span><span class="token string">'sheet_03'</span><span class="token punctuation">,</span>order<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">]</span><span class="token punctuation">)</span>
</code></pre></div></li></ul> <hr> <h3 id="setsheetzoom-zoom-setting"><a href="#setsheetzoom-zoom-setting" class="header-anchor">#</a> setSheetZoom(zoom [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Number} [zoom]: 工作表缩放比例，值范围为0.1 ~ 4；</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>设置工作表缩放比例</p></li> <li><p><strong>示例</strong>:</p> <ul><li>设置当前工作表缩放比例为0.5</li></ul> <div class="language-js extra-class"><pre class="language-js"><code>luckysheet<span class="token punctuation">.</span><span class="token function">setSheetZoom</span><span class="token punctuation">(</span><span class="token number">0.5</span><span class="token punctuation">)</span>
</code></pre></div></li></ul> <hr> <h3 id="showgridlines-setting"><a href="#showgridlines-setting" class="header-anchor">#</a> showGridLines([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 需要显示网格线的工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>显示指定下标工作表的网格线，返回操作的工作表对象</p></li> <li><p><strong>示例</strong>:</p> <ul><li>显示当前工作表的网格线
<code>luckysheet.showGridLines()</code></li> <li>显示第三个工作表的网格线
<code>luckysheet.showGridLines({order:2})</code></li></ul></li></ul> <hr> <h3 id="hidegridlines-setting"><a href="#hidegridlines-setting" class="header-anchor">#</a> hideGridLines([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 需要隐藏网格线的工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>隐藏指定下标工作表的网格线，返回操作的工作表对象</p></li> <li><p><strong>示例</strong>:</p> <ul><li>隐藏当前工作表的网格线
<code>luckysheet.hideGridLines()</code></li> <li>隐藏第三个工作表的网格线
<code>luckysheet.hideGridLines({order:2})</code></li></ul></li></ul> <hr> <h2 id="工作簿操作"><a href="#工作簿操作" class="header-anchor">#</a> 工作簿操作</h2> <h3 id="create-options"><a href="#create-options" class="header-anchor">#</a> create(options)</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Object} [options]:表格的所有配置信息</li></ul></li> <li><p><strong>说明</strong>：</p> <p>初始化一个Luckysheet，可包含多个工作表，参考 <a href="/LuckysheetDocs/zh/guide/config.html">配置列表</a></p></li></ul> <hr> <h3 id="refresh-setting"><a href="#refresh-setting" class="header-anchor">#</a> refresh([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Function} [success]: 表格刷新成功后的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>刷新canvas</p></li></ul> <hr> <h3 id="scroll-setting"><a href="#scroll-setting" class="header-anchor">#</a> scroll([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [scrollLeft]：横向滚动值。默认为当前横向滚动位置。</li> <li>{Number} [scrollTop]：纵向滚动值。默认为当前纵向滚动位置。</li> <li>{Number} [targetRow]：纵向滚动到指定的行号。默认为当前纵向滚动位置。</li> <li>{Number} [targetColumn]：横向滚动到指定的列号。默认为当前横向滚动位置。</li> <li>{Function} [success]: 表格刷新成功后的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>滚动当前工作表位置</p></li></ul> <hr> <h3 id="resize-setting"><a href="#resize-setting" class="header-anchor">#</a> resize([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>根据窗口大小自动resize画布</p></li></ul> <hr> <h3 id="destroy-setting"><a href="#destroy-setting" class="header-anchor">#</a> destroy([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Function} [success]: 表格释放成功后的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>删除并释放表格</p></li></ul> <hr> <h3 id="getscreenshot-setting"><a href="#getscreenshot-setting" class="header-anchor">#</a> getScreenshot([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Object | String} [range]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>返回当前表格指定选区截图后生成的base64格式的图片</p></li></ul> <hr> <h3 id="setworkbookname-name-setting"><a href="#setworkbookname-name-setting" class="header-anchor">#</a> setWorkbookName(name [,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{String} [name]: 工作簿名称</li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>设置工作簿名称</p></li></ul> <hr> <h3 id="getworkbookname-setting"><a href="#getworkbookname-setting" class="header-anchor">#</a> getWorkbookName([,setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>获取工作簿名称</p></li></ul> <hr> <h3 id="undo-setting"><a href="#undo-setting" class="header-anchor">#</a> undo([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>撤销当前操作，返回刚刚撤销的操作对象</p></li></ul> <hr> <h3 id="redo-setting"><a href="#redo-setting" class="header-anchor">#</a> redo([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>重做当前操作，返回刚刚重做的操作对象</p></li></ul> <hr> <h3 id="refreshformula-success"><a href="#refreshformula-success" class="header-anchor">#</a> refreshFormula([success])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li> <li><p><strong>说明</strong>：</p> <p>强制刷新公式。当你直接修改了多个单元格的值，且没有触发刷新，且这些单元格跟公式相关联，则可以使用这个api最后强制触发一次公式刷新。</p></li></ul> <hr> <h3 id="refreshmenubuttonfocus-data-r-c-success"><a href="#refreshmenubuttonfocus-data-r-c-success" class="header-anchor">#</a> refreshMenuButtonFocus([data],[r],[c],[success])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Array}  [data]: 操作数据</li> <li>{Number} [r]: 指定的行</li> <li>{Number} [c]: 指定的列</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li> <li><p><strong>说明</strong>：</p> <p>刷新指定单元格的顶部状态栏状态。</p></li></ul> <hr> <h2 id="图表"><a href="#图表" class="header-anchor">#</a> 图表</h2> <h3 id="insertchart-setting"><a href="#insertchart-setting" class="header-anchor">#</a> insertChart([setting])</h3> <p>[todo]</p> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Array | Object | String} [range]: 图表数据的选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>指定工作表指定选区范围生成一个图表，返回图表参数对象，包含图表唯一标识符chart id</p></li></ul> <hr> <h3 id="setchart-chartid-attr-value-setting"><a href="#setchart-chartid-attr-value-setting" class="header-anchor">#</a> setChart(chartId, attr, value [,setting])</h3> <p>[todo]</p> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [chartId]: 指定要修改的图表id</p></li> <li><p>{String} [attr]: 属性类型</p> <p><code>attr</code>可能的值有：</p> <ul><li><code>&quot;left&quot;</code>: 左边到工作表边缘的距离</li> <li><code>&quot;top&quot;</code>: 上边到工作表边缘的距离</li> <li><code>&quot;width&quot;</code>: 图表外框的宽度</li> <li><code>&quot;height&quot;</code>: 图表外框的高度</li> <li><code>&quot;chartOptions&quot;</code>: 图表的详细设置项</li></ul></li> <li><p>{Number | Object}} [value]: 属性值，当<code>attr</code>为<code>chartOptions</code>时，直接设置整个chart的配置对象</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>修改指定id图表的参数，返回修改后的整个图表参数</p></li></ul> <hr> <h3 id="getchart-chartid"><a href="#getchart-chartid" class="header-anchor">#</a> getChart(chartId)</h3> <p>[todo]</p> <ul><li><p><strong>参数</strong>：</p> <ul><li>{String} [chartId]: 指定要获取的图表id</li></ul></li> <li><p><strong>说明</strong>：</p> <p>获取指定id图表的参数</p></li></ul> <hr> <h3 id="deletechart-chartid-setting"><a href="#deletechart-chartid-setting" class="header-anchor">#</a> deleteChart(chartId [,setting])</h3> <p>[todo]</p> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{String} [chartId]: 要删除的图表id</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>删除指定id图表，返回被删除的图表的参数</p></li></ul> <hr> <h2 id="数据验证"><a href="#数据验证" class="header-anchor">#</a> 数据验证</h2> <h3 id="setdataverification-optionitem-setting"><a href="#setdataverification-optionitem-setting" class="header-anchor">#</a> setDataVerification(optionItem, [setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Object} [optionItem]: 数据验证的配置信息，具体详细的配置信息参考<a href="/LuckysheetDocs/zh/guide/sheet.html#dataVerification">dataVerification</a></p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Object | String} [range]: 数据验证的选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>指定工作表范围设置数据验证功能，并设置参数</p></li></ul> <hr> <h3 id="deletedataverification-setting"><a href="#deletedataverification-setting" class="header-anchor">#</a> deleteDataVerification([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Object | String} [range]: 数据验证的选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>、<code>&quot;sheetName!A1:B2&quot;</code>或者<code>{row:[0,1],column:[0,1]}</code>，只能为单个选区；默认为当前选区</li> <li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>指定工作表范围删除数据验证功能</p></li></ul> <hr> <h2 id="图片"><a href="#图片" class="header-anchor">#</a> 图片</h2> <h3 id="insertimage-src-setting"><a href="#insertimage-src-setting" class="header-anchor">#</a> insertImage(src, [setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{String} [src]: 图片src</li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Number} [rowIndex]: 要插入图片的单元格行下标；默认为当前选区聚焦单元格行下标 || 0</li> <li>{Number} [colIndex]: 要插入图片的单元格列下标；默认为当前选区聚焦单元格列下标 || 0</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>在指定的工作表中指定单元格位置插入图片</p></li></ul> <h3 id="deleteimage-setting"><a href="#deleteimage-setting" class="header-anchor">#</a> deleteImage([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{String | Array} [idList]: 要删除图片的id集合，也可为字符串<code>&quot;all&quot;</code>，all为所有的字符串；默认为<code>&quot;all&quot;</code></li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>删除指定工作表中的图片</p></li></ul> <h3 id="getimageoption-setting"><a href="#getimageoption-setting" class="header-anchor">#</a> getImageOption([setting])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>获取指定工作表的图片配置</p></li></ul> <h2 id="工作表保护"><a href="#工作表保护" class="header-anchor">#</a> 工作表保护</h2> <h3 id="setprotection-option-setting"><a href="#setprotection-option-setting" class="header-anchor">#</a> setProtection(option, [setting])</h3> <p>[todo]</p> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Object} [option]: 工作表保护的配置信息</li> <li>{PlainObject} [setting]: 可选参数
<ul><li>{Number} [order]: 工作表下标；默认值为当前工作表下标</li> <li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>指定工作表设置工作表保护功能</p></li></ul> <hr> <h2 id="工具方法"><a href="#工具方法" class="header-anchor">#</a> 工具方法</h2> <h3 id="transtocelldata-data-setting"><a href="#transtocelldata-data-setting" class="header-anchor">#</a> transToCellData(data [,setting])<div id="transToCellData"></div></h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Array} [data]: data数据</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>data =&gt; celldata ，data二维数组数据转化成 {r, c, v}格式一维数组</p></li></ul> <hr> <h3 id="transtodata-celldata-setting"><a href="#transtodata-celldata-setting" class="header-anchor">#</a> transToData(celldata [,setting])<div id="transToData"></div></h3> <ul><li><p><strong>参数</strong>：</p> <ul><li><p>{Array} [celldata]: data数据</p></li> <li><p>{PlainObject} [setting]: 可选参数</p> <ul><li>{Function} [success]: 操作结束的回调函数</li></ul></li></ul></li> <li><p><strong>说明</strong>：</p> <p>celldata =&gt; data ，celldata一维数组数据转化成表格所需二维数组</p></li></ul> <hr> <h3 id="tojson"><a href="#tojson" class="header-anchor">#</a> toJson()</h3> <ul><li><p><strong>说明</strong>：</p> <p>导出的json字符串可以直接当作<code>luckysheet.create(options)</code>初始化工作簿时的参数<code>options</code>使用，使用场景在用户自己操作表格后想要手动保存全部的参数，再去别处初始化这个表格使用，类似一个luckysheet专有格式的导入导出。</p></li></ul> <hr> <h3 id="changlang-lang"><a href="#changlang-lang" class="header-anchor">#</a> changLang([lang])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{String} [lang]: 语言类型；暂支持<code>&quot;zh&quot;</code>、<code>&quot;en&quot;</code>、<code>&quot;es&quot;</code>；默认为<code>&quot;zh&quot;</code>；</li></ul></li> <li><p><strong>说明</strong>：</p> <p>传入目标语言，切换到对应的语言界面</p></li></ul> <h3 id="closewebsocket"><a href="#closewebsocket" class="header-anchor">#</a> closeWebsocket()</h3> <ul><li><p><strong>说明</strong>：</p> <p>关闭websocket连接</p></li></ul> <h3 id="getrangebytxt-txt"><a href="#getrangebytxt-txt" class="header-anchor">#</a> getRangeByTxt([txt])</h3> <ul><li><p><strong>说明</strong>：</p> <p>将字符串格式的工作表范围转换为数组形式</p></li> <li><p><strong>参数</strong>：</p> <ul><li>{String} [txt]: 选区范围,支持选区的格式为<code>&quot;A1:B2&quot;</code>或者指定工作表名称的写法<code>&quot;sheetName!A1:B2&quot;</code>，只支持单个选区；默认为当前最后一个选区</li></ul></li> <li><p><strong>示例</strong>:</p> <ul><li>当前选区为<code>A1:B2</code>，<code>luckysheet.getRangeByTxt()</code>返回：<code>{column: (2) [0, 1],row: (2) [0, 1]}</code></li> <li><code>luckysheet.getRangeByTxt(&quot;A1:B2&quot;)</code>返回：<code>{column: (2) [0, 1],row: (2) [0, 1]}</code></li> <li><code>luckysheet.getRangeByTxt(&quot;Cell!A1:B2&quot;)</code>返回：<code>{column: (2) [0, 1],row: (2) [0, 1]}</code></li></ul></li></ul> <hr> <h3 id="gettxtbyrange-range"><a href="#gettxtbyrange-range" class="header-anchor">#</a> getTxtByRange([range])</h3> <ul><li><p><strong>说明</strong>：</p> <p>将数组格式的工作表范围转换为字符串格式的形式</p></li> <li><p><strong>参数</strong>：</p> <ul><li>{Array | Object} [range]: 选区范围,支持选区的格式为<code>{row:[0,1],column:[0,1]}</code>，允许多个选区组成的数组；默认为当前选区</li></ul></li> <li><p><strong>示例</strong>:</p> <ul><li>当前选区为<code>A1:B3</code>，<code>luckysheet.getTxtByRange()</code>返回：当前选区<code>&quot;A1:B3&quot;</code></li> <li><code>luckysheet.getTxtByRange({column:[0,1],row:[0,2]})</code>返回：<code>&quot;A1:B3&quot;</code></li> <li><code>luckysheet.getTxtByRange([{column:[0,1],row:[0,2]}])</code>返回：<code>&quot;A1:B3&quot;</code></li> <li><code>luckysheet.getTxtByRange([{column:[0,1],row:[0,2]},{column:[1,1],row:[1,2]}])</code>返回：<code>&quot;A1:B3,B2:B3&quot;</code></li></ul></li></ul> <hr> <h2 id="旧版api"><a href="#旧版api" class="header-anchor">#</a> 旧版API</h2> <div class="custom-block warning"><p class="custom-block-title">注意</p> <p>为保持兼容性，仍然支持旧版API，但是已不推荐使用。</p></div> <h3 id="getcellvalue-r-c-data-type"><a href="#getcellvalue-r-c-data-type" class="header-anchor">#</a> getcellvalue([r] [,c] [,data] [,type])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Number} [r]:单元格所在行数；可选值；从0开始的整数，0表示第一行</li> <li>{Number} [c]:单元格所在列数；可选值；从0开始的整数，0表示第一列</li> <li>{Array} [data]:表数据，二维数组；可选值；默认值为当前表格数据</li> <li>{String} [type]:单元格属性值；可选值；默认值为'v',表示获取单元格的实际值</li></ul></li> <li><p><strong>说明</strong>：</p> <p>此方法为获取单元格的值。</p> <ul><li>luckysheet.getcellvalue()：返回当前工作表的所有数据；</li> <li>luckysheet.getcellvalue(0)：返回当前工作表第1行数据；</li> <li>luckysheet.getcellvalue(null,0)：返回当前工作表第1列数据；</li> <li>luckysheet.getcellvalue(0,0)：返回当前工作表第1行第1列单元格的数据的v值；</li> <li>luckysheet.getcellvalue(1,1,null,'m'): 返回指定data数据的第2行第2列单元格的原始值。</li></ul> <p>特殊情况：单元格格式为yyyy-MM-dd，type为'v'时会强制取'm'显示值</p> <blockquote><p>推荐使用新API： <a href="#getCellValue">getCellValue</a></p></blockquote></li></ul> <hr> <h3 id="getluckysheetfile-2"><a href="#getluckysheetfile-2" class="header-anchor">#</a> getluckysheetfile()</h3> <ul><li><p><strong>说明</strong>：</p> <p>返回所有表格数据结构的一维数组<code>luckysheetfile</code></p> <blockquote><p>推荐使用新API： <a href="#getLuckysheetfile()">getLuckysheetfile</a></p></blockquote></li></ul> <hr> <h3 id="getconfig"><a href="#getconfig" class="header-anchor">#</a> getconfig()</h3> <ul><li><p><strong>说明</strong>：</p> <p>快捷返回当前表格config配置，每个工作表的config信息仍然包含在luckysheetfile。</p> <blockquote><p>推荐使用新API： <a href="#getConfig(%5Bsetting%5D)">getConfig</a></p></blockquote></li></ul> <hr> <h3 id="getluckysheet-select-save"><a href="#getluckysheet-select-save" class="header-anchor">#</a> getluckysheet_select_save()</h3> <ul><li><p><strong>说明</strong>：</p> <p>返回当前选区对象的数组，可能存在多个选区。</p> <blockquote><p>推荐使用新API： <a href="#getRange()">getRange</a></p></blockquote></li></ul> <hr> <h3 id="getdatabyselection-range-sheetorder"><a href="#getdatabyselection-range-sheetorder" class="header-anchor">#</a> getdatabyselection([range] [,sheetOrder])</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Object} [range]：选区对象，<code>object: { row: [r1, r2], column: [c1, c2] }</code>；默认为当前第一个选区。</li> <li>{Number} [sheetOrder]：表格下标，从0开始的整数，0表示第一个表格；默认为当前表格下标。</li></ul></li> <li><p><strong>说明</strong>：</p> <p>返回某个表格第一个选区的数据。</p> <ul><li><code>luckysheet.getdatabyselection()</code>: 返回当前工作表当前选区的数据</li> <li><code>luckysheet.getdatabyselection(null,1)</code>: 返回第2个工作表的当前选区的数据</li></ul> <blockquote><p>推荐使用新API： <a href="#getRangeValue(%5Bsetting%5D)">getRangeValue</a></p></blockquote></li></ul> <hr> <h3 id="luckysheetrefreshgrid-scrollwidth-scrollheight"><a href="#luckysheetrefreshgrid-scrollwidth-scrollheight" class="header-anchor">#</a> luckysheetrefreshgrid(scrollWidth, scrollHeight)</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Number} [scrollWidth]：横向滚动值。默认为当前横向滚动位置。</li> <li>{Number} [scrollHeight]：纵向滚动值。默认为当前纵向滚动位置。</li></ul></li> <li><p><strong>说明</strong>：</p> <p>按照scrollWidth, scrollHeight刷新canvas展示数据。</p> <blockquote><p>推荐使用新API： <a href="/LuckysheetDocs/zh/guide/api.html#scroll-setting">scroll</a></p></blockquote></li></ul> <hr> <h3 id="setcellvalue-r-c-d-v"><a href="#setcellvalue-r-c-d-v" class="header-anchor">#</a> setcellvalue(r, c, d, v)</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Number} [r]：单元格所在行数；从0开始的整数，0表示第一行。</li> <li>{Number} [c]：单元格所在列数；从0开始的整数，0表示第一列。</li> <li>{Array} [d]：表数据；可选值；二维数组。</li> <li>{Object | String | Number} [v]：要设置的值；可为对象，对象是是要符合单元格对象格式。</li></ul></li> <li><p><strong>说明</strong>：</p> <p>设置某个单元格的值。可配合<code>luckysheet.jfrefreshgrid()</code>刷新查看单元格值改变。</p> <div class="language-js extra-class"><pre class="language-js"><code>luckysheet<span class="token punctuation">.</span><span class="token function">setcellvalue</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">,</span> luckysheet<span class="token punctuation">.</span><span class="token function">flowdata</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
luckysheet<span class="token punctuation">.</span><span class="token function">jfrefreshgrid</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div></li></ul> <hr> <h3 id="jfrefreshgrid"><a href="#jfrefreshgrid" class="header-anchor">#</a> jfrefreshgrid()</h3> <ul><li><p><strong>说明</strong>：</p> <p>刷新canvas</p> <blockquote><p>推荐使用新API： <a href="#refresh(%5Bsetting%5D)">refresh</a></p></blockquote></li></ul> <hr> <h3 id="setluckysheet-select-save-v"><a href="#setluckysheet-select-save-v" class="header-anchor">#</a> setluckysheet_select_save(v)</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Array} [v]：要设置的选区值(数组)。符合选区格式规则，如<code>[{ row: [r1, r2], column: [c1, c2] }]</code>。</li></ul></li> <li><p><strong>说明</strong>：</p> <p>设置当前表格选区的值。配合<code>luckysheet.selectHightlightShow()</code>可在界面查看选区改变。</p> <div class="language-js extra-class"><pre class="language-js"><code>luckysheet<span class="token punctuation">.</span><span class="token function">setluckysheet_select_save</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">{</span> row<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">,</span> column<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
luckysheet<span class="token punctuation">.</span><span class="token function">selectHightlightShow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div><blockquote><p>推荐使用新API：<a href="#setRangeShow">setRangeShow</a></p></blockquote></li></ul> <hr> <h3 id="selecthightlightshow"><a href="#selecthightlightshow" class="header-anchor">#</a> selectHightlightShow()</h3> <ul><li><p><strong>说明</strong>：</p> <p>高亮当前选区</p> <blockquote><p>推荐使用新API：<a href="#setRangeShow">setRangeShow</a></p></blockquote></li></ul> <hr> <h3 id="flowdata"><a href="#flowdata" class="header-anchor">#</a> flowdata()</h3> <ul><li><p><strong>说明</strong>：</p> <p>快捷获取当前表格的数据</p> <blockquote><p>推荐使用新API：<a href="#getSheetData()">getSheetData</a></p></blockquote></li></ul> <hr> <h3 id="buildgriddata-file"><a href="#buildgriddata-file" class="header-anchor">#</a> buildGridData(file)</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Object} [file]：<a href="/LuckysheetDocs/zh/guide/sheet.html">luckysheetfile</a></li></ul></li> <li><p><strong>说明</strong>：</p> <p>生成表格可以识别的二维数组</p> <blockquote><p>推荐使用新API：<a href="#transToData">transToData</a></p></blockquote></li></ul> <hr> <h3 id="getgriddata-data"><a href="#getgriddata-data" class="header-anchor">#</a> getGridData(data)</h3> <ul><li><p><strong>参数</strong>：</p> <ul><li>{Array} [data]：工作表的二维数组数据</li></ul></li> <li><p><strong>说明</strong>：</p> <p>二维数组数据转化成 <code>{r, c, v}</code> 格式 一维数组</p> <blockquote><p>推荐使用新API：<a href="#transToCellData">transToCellData</a></p></blockquote></li></ul></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/mengshukeji/Luckysheet/edit/master/docs/zh/guide/api.md" target="_blank" rel="noopener noreferrer">在 GitHub 上编辑此页</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">1/19/2021, 1:33:53 AM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/LuckysheetDocs/zh/guide/operate.html" class="prev">
        表格操作
      </a></span> <span class="next"><a href="/LuckysheetDocs/zh/guide/resource.html">
        教程与资源
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"></div></div>
    <script src="/LuckysheetDocs/assets/js/app.02d9598d.js" defer></script><script src="/LuckysheetDocs/assets/js/2.daa13025.js" defer></script><script src="/LuckysheetDocs/assets/js/27.1142ecb7.js" defer></script>
  </body>
</html>
